Following is what I use in docker-compose and it works
    volumes:
      - /c/Users/abc/config:/agentsvolume

I use when run Docker command directly to run the image
    docker run -v /home/blockchain/agentsconfig:/agentsvolume app-agent

agentsvolume is a volume that i have created using docker create volume
command and name is agentsvolume

I have a config file stored at the c/Users/abc/config:/agentsvolume or
 /home/blockchain/agentsconfig which gets copied into volume that i have
created and same is used inside Dockerfile

Similar I want to use
  -v /home/blockchain/agentsconfig:/agentsvolume

actual host is name and value is mount point.

from error looks like able to do it

"agentk" in pod "agent-kuber-1396289937-7cbnp" is waiting to start: rpc
error: code = 2 desc = Error response from daemon: {"message":"Invalid bind
mount spec \"/usr/share/applications/config:agentcompose_agentsvolume\":
Invalid volume destination path: 'agentcompose_agentsvolume' mount path
must be absolute."}



/usr/share/applications/config:agentcompose_agentsvolume



On Thu, Sep 21, 2017 at 8:58 PM, 'Tim Hockin' via Kubernetes user
discussion and Q&A <kubernetes-users@googlegroups.com> wrote:

> I strongly urge you to look at the docs for pods and volumes.
>
> spec.containers[].volumeMounts[].mountPath is a path within your
> container, where you want that volume attached.
>
> On Thu, Sep 21, 2017 at 2:36 AM, Shashank Dutt Jha
> <shashank...@gmail.com> wrote:
> > I get following error
> >
> >
> > "agentk" in pod "agent-kuber-1396289937-7cbnp" is waiting to start: rpc
> > error: code = 2 desc = Error response from daemon: {"message":"Invalid
> bind
> > mount spec \"/usr/share/applications/config:agentcompose_agentsvolume\":
> > Invalid volume destination path: 'agentcompose_agentsvolume' mount path
> must
> > be absolute."}
> >
> > For this configuration
> >
> > apiVersion: apps/v1beta1
> > kind: Deployment
> > metadata:
> >   name: agent-kuber
> > spec:
> >   replicas: 1
> >   template:
> >     metadata:
> >       labels:
> >         run: agentc
> >     spec:
> >       containers:
> >       - name: agentk
> >         image: library/app-agentk:v1
> >         env:
> >         - name: VOLUMEDIR
> >           value: /agentcompose_agentsvolume
> >         volumeMounts:
> >         - name: config
> >           mountPath: agentcompose_agentsvolume
> >       volumes:
> >        - name: config
> >          hostPath:
> >           path: /usr/share/applications/config
> >
> >
> >
> > On Thu, Sep 21, 2017 at 2:59 PM, Shashank Dutt Jha <
> shashank...@gmail.com>
> > wrote:
> >>
> >> Following error in logs
> >> starting the app
> >> /agentcompose_agentsvolume/config.yml
> >>
> >> IOError: [Errno 2] No such file or directory:
> >> '/agentcompose_agentsvolume/config.yml'
> >>
> >>
> >> /agentcompose_agentsvolume is not replaced by path
> >> /usr/share/applications/config
> >> if I do ls /usr/share/applications/config I can see the config.yml there
> >>
> >>
> >> apiVersion: apps/v1beta1
> >> kind: Deployment
> >> metadata:
> >>   name: agent-kuber
> >> spec:
> >>   replicas: 1
> >>   template:
> >>     metadata:
> >>       labels:
> >>         run: agentc
> >>     spec:
> >>       containers:
> >>       - name: agentk
> >>         image: library/app-agentk:v1
> >>         env:
> >>         - name: VOLUMEDIR
> >>           value: /agentcompose_agentsvolume
> >>         volumeMounts:
> >>         - name: config
> >>           mountPath: /usr/share/applications/config
> >>       volumes:
> >>        - name: config
> >>          hostPath:
> >>           path: agentcompose_agentsvolume
> >>
> >> On Thu, Sep 21, 2017 at 12:00 AM, 'Tim Hockin' via Kubernetes user
> >> discussion and Q&A <kubernetes-users@googlegroups.com> wrote:
> >>>
> >>> On Wed, Sep 20, 2017 at 5:25 AM, Shashank Dutt Jha
> >>> <shashank...@gmail.com> wrote:
> >>> >
> >>> > $ kubectl apply -f kuber-agent.yml
> >>> > The Deployment "agent-kuber" is invalid:
> >>> > * spec.template.spec.volumes[0].hostPath: Forbidden: may not specify
> >>> > more
> >>> > than 1 volume type
> >>>
> >>> You have more than one source listed in a volume block
> >>>
> >>> > * spec.template.spec.volumes[0].persistentVolumeClaim: Forbidden:
> may
> >>> > not
> >>> > specify more than 1 volume type
> >>> > * spec.template.spec.containers[0].volumeMounts[0].name: Not found:
> >>> > "config"
> >>>
> >>>
> >>>
> >>> > Now my config file is as:
> >>> > linux style file system is accesible from Docker Tool environment
> >>> >
> >>> >
> >>> > metadata:
> >>> >   name: agent-kuber
> >>> > spec:
> >>> >   replicas: 1
> >>> >   template:
> >>> >     metadata:
> >>> >       labels:
> >>> >         run: agentc
> >>> >     spec:
> >>> >       containers:
> >>> >       - name: agentk
> >>> >         image: library/app-agentk:v1
> >>> >         env:
> >>> >         - name: VOLUMEDIR
> >>> >           value: /agentsvolume
> >>> >         volumeMounts:
> >>> >         - name: config
> >>> >           mountPath: /usr/share/applications/config
> >>> >       volumes:
> >>> >        - name: config
> >>> >          hostPath:
> >>> >           path: agentsvolume
> >>>
> >>> You need a new `- name: something` line to start a new array item.
> >>> YAML is funky.  When in doubt, convert to JSON and it will be clearer.
> >>>
> >>> >          persistentVolumeClaim:
> >>> >           claimName: logs-nfs
> >>> >
> >>> >
> >>> >
> >>> >
> >>> > On Wed, Sep 20, 2017 at 3:03 PM, Shashank Dutt Jha
> >>> > <shashank...@gmail.com>
> >>> > wrote:
> >>> >>
> >>> >> I get this error now:
> >>> >>
> >>> >> $ kubectl apply -f kuber-agent.yml
> >>> >> error: error validating "kuber-agent.yml": error validating data:
> >>> >> found
> >>> >> invalid field path for v1.Volume; if you choose to ignore these
> >>> >> errors, turn
> >>> >> validation off with --validate=false
> >>> >>
> >>> >> apiVersion: apps/v1beta1
> >>> >> kind: Deployment
> >>> >> metadata:
> >>> >>   name: agent-kuber
> >>> >> spec:
> >>> >>   replicas: 1
> >>> >>   template:
> >>> >>     metadata:
> >>> >>       labels:
> >>> >>         run: agentc
> >>> >>     spec:
> >>> >>       containers:
> >>> >>       - name: agentk
> >>> >>         image: library/app-agentk:v1
> >>> >>         env:
> >>> >>         - name: VOLUMEDIR
> >>> >>           value: /agentsvolume
> >>> >>         volumeMounts:
> >>> >>         - name: config
> >>> >>           mountPath: /c/Users/abc/config
> >>> >>       volumes:
> >>> >>        - name: config
> >>> >>          hostPath:
> >>> >>          path: agentsvolume
> >>> >>
> >>> >> On Wed, Sep 20, 2017 at 2:24 PM, Shashank Dutt Jha
> >>> >> <shashank...@gmail.com>
> >>> >> wrote:
> >>> >>>
> >>> >>> Now I get following error: following your suggestion
> >>> >>>
> >>> >>> $ kubectl apply -f kuber-agent.yml
> >>> >>> error: error validating "kuber-agent.yml": error validating data:
> >>> >>> found
> >>> >>> invalid field volumes for v1beta1.DeploymentSpec; if you choose to
> >>> >>> ignore
> >>> >>> these errors, turn validation off with --validate=false
> >>> >>>
> >>> >>>
> >>> >>> kuber-agent.yml
> >>> >>>
> >>> >>> apiVersion: apps/v1beta1
> >>> >>> kind: Deployment
> >>> >>> metadata:
> >>> >>>   name: agent-kuber
> >>> >>> spec:
> >>> >>>   replicas: 1
> >>> >>>   template:
> >>> >>>     metadata:
> >>> >>>       labels:
> >>> >>>         run: agentc
> >>> >>>     spec:
> >>> >>>       containers:
> >>> >>>       - name: agentk
> >>> >>>         image: library/app-agentk:v1
> >>> >>>         env:
> >>> >>>         - name: VOLUMEDIR
> >>> >>>           value: agentsvolume
> >>> >>>         volumeMounts:
> >>> >>>         - name: config
> >>> >>>           mountPath: /agentsvolume
> >>> >>>   volumes:
> >>> >>>   - name: config
> >>> >>>     hostPath:
> >>> >>>      path:/c/Users/abc/config
> >>> >>>
> >>> >>>
> >>> >>> On Tue, Sep 19, 2017 at 9:54 PM, 'Tim Hockin' via Kubernetes user
> >>> >>> discussion and Q&A <kubernetes-users@googlegroups.com> wrote:
> >>> >>>>
> >>> >>>> Your volume config is not valid.  What you need depends on whether
> >>> >>>> you
> >>> >>>> want your volume to literally map `/c/Users/abcd/config` (which
> you
> >>> >>>> manage out of band, kubernetes won't touch) into your container or
> >>> >>>> whether you want just "an empty directory".
> >>> >>>>
> >>> >>>> The literal equivalent would be more like:
> >>> >>>>
> >>> >>>> ```
> >>> >>>> apiVersion: apps/v1beta1
> >>> >>>> kind: Deployment
> >>> >>>> metadata:
> >>> >>>>   name: agent-kuber
> >>> >>>> spec:
> >>> >>>>   replicas: 1 # optional, defaults to 1
> >>> >>>>   template:
> >>> >>>>     metadata:
> >>> >>>>       labels:
> >>> >>>>         run: agentc
> >>> >>>>     spec:
> >>> >>>>       containers:
> >>> >>>>       - name: app-agent
> >>> >>>>         image: app-agent
> >>> >>>>         env:
> >>> >>>>         - name: VOLUMEDIR
> >>> >>>>           value: agentsvolume
> >>> >>>>         volumeMounts:
> >>> >>>>         - name: config
> >>> >>>>           mountPath: /agentsvolume
> >>> >>>>   volumes:
> >>> >>>>   - name: config
> >>> >>>>     hostPath:
> >>> >>>>       path: /c/Users/abcd/config
> >>> >>>> ```
> >>> >>>>
> >>> >>>> On Tue, Sep 19, 2017 at 9:06 AM, paperless <shashank...@gmail.com
> >
> >>> >>>> wrote:
> >>> >>>> > This is not production. This is just local image. Trying to
> learn
> >>> >>>> > basics.
> >>> >>>> >
> >>> >>>> > This is my kubernetes config file
> >>> >>>> >
> >>> >>>> > apiVersion: apps/v1beta1
> >>> >>>> > kind: Deployment
> >>> >>>> > metadata:
> >>> >>>> >   name: agent-kuber
> >>> >>>> > spec:
> >>> >>>> >   replicas: 1
> >>> >>>> >   template:
> >>> >>>> >     metadata:
> >>> >>>> >       labels:
> >>> >>>> >         run: agentc
> >>> >>>> >     spec:
> >>> >>>> >       containers:
> >>> >>>> >       - name: agentk
> >>> >>>> >         image: agentc
> >>> >>>> >         env:
> >>> >>>> > - name: VOLUMEDIR
> >>> >>>> >           value: "agentsvolume"
> >>> >>>> >         volumeMounts:
> >>> >>>> >         - name: /agentsvolume
> >>> >>>> >           mountPath: /c/Users/abcd/config:/agentsvolume
> >>> >>>> >   volumes:
> >>> >>>> >   - name: agentsvolume
> >>> >>>> >     emptyDir: {}
> >>> >>>> >
> >>> >>>> > Is the deployment configuration now equivalent?
> >>> >>>> >
> >>> >>>> >
> >>> >>>> > On Tuesday, 19 September 2017 21:11:37 UTC+5:30, Rodrigo Campos
> >>> >>>> > wrote:
> >>> >>>> >>
> >>> >>>> >> On Tue, Sep 19, 2017 at 07:57:55AM -0700, paperless wrote:
> >>> >>>> >> >
> >>> >>>> >> >
> >>> >>>> >> > I have developed a simple Docker image. This can be run using
> >>> >>>> >> > command
> >>> >>>> >> >
> >>> >>>> >> > docker run -e VOLUMEDIR=agentsvolume -v
> >>> >>>> >> > /c/Users/abcd/config:/agentsvolume app-agent
> >>> >>>> >> >
> >>> >>>> >> > Same thing if I want to run using kubernetes, can someone
> guide
> >>> >>>> >> > me
> >>> >>>> >> > what
> >>> >>>> >> > are
> >>> >>>> >> > the steps to do it? Do I must create Pods/ Controller or
> >>> >>>> >> > service..
> >>> >>>> >> > am
> >>> >>>> >> > not
> >>> >>>> >> > able to get clear steps to run using Kubernetes?
> >>> >>>> >>
> >>> >>>> >> Have you take a look to deployments? Just use that with the
> >>> >>>> >> docker
> >>> >>>> >> image
> >>> >>>> >> from a
> >>> >>>> >> docker registry.
> >>> >>>> >>
> >>> >>>> >> Not sure what your volume is. Is this how you want this to run
> on
> >>> >>>> >> production?
> >>> >>>> >>
> >>> >>>> >> >
> >>> >>>> >> >
> >>> >>>> >> > If I run anything using kuberctl i get following error:
> >>> >>>> >> >
> >>> >>>> >> >
> >>> >>>> >> > $ kubectl get pods
> >>> >>>> >> >
> >>> >>>> >> > error: group map[extensions:0xc0823b44d0 policy:0xc0823b4540
> >>> >>>> >> > federation:0xc08230f9d0 :0xc08230fea0 apps:0xc08230ff10
> >>> >>>> >> > batch:0xc0823b4310
> >>> >>>> >> > certificates.k8s.io:0xc0823b4380
> componentconfig:0xc0823b43f0
> >>> >>>> >> > authentication.k8s.io:0xc08230ff80
> >>> >>>> >> > authorization.k8s.io:0xc0823b40e0
> >>> >>>> >> > autoscaling:0xc0823b4150 rbac.authorization.k8s.io:0xc0
> 823b45b0
> >>> >>>> >> > storage.k8s.io:0xc0823b4620] is already registered
> >>> >>>> >>
> >>> >>>> >> I've seen this some time. IIRC you are using quite different
> >>> >>>> >> kubectl
> >>> >>>> >> and
> >>> >>>> >> kubernetes server versions, or something like that
> >>> >>>> >
> >>> >>>> > --
> >>> >>>> > You received this message because you are subscribed to the
> Google
> >>> >>>> > Groups
> >>> >>>> > "Kubernetes user discussion and Q&A" group.
> >>> >>>> > To unsubscribe from this group and stop receiving emails from
> it,
> >>> >>>> > send
> >>> >>>> > an
> >>> >>>> > email to kubernetes-users+unsubscr...@googlegroups.com.
> >>> >>>> > To post to this group, send email to
> >>> >>>> > kubernetes-users@googlegroups.com.
> >>> >>>> > Visit this group at
> >>> >>>> > https://groups.google.com/group/kubernetes-users.
> >>> >>>> > For more options, visit https://groups.google.com/d/optout.
> >>> >>>>
> >>> >>>> --
> >>> >>>> You received this message because you are subscribed to a topic in
> >>> >>>> the
> >>> >>>> Google Groups "Kubernetes user discussion and Q&A" group.
> >>> >>>> To unsubscribe from this topic, visit
> >>> >>>>
> >>> >>>> https://groups.google.com/d/topic/kubernetes-users/
> TpPb25xKlko/unsubscribe.
> >>> >>>> To unsubscribe from this group and all its topics, send an email
> to
> >>> >>>> kubernetes-users+unsubscr...@googlegroups.com.
> >>> >>>> To post to this group, send email to
> >>> >>>> kubernetes-users@googlegroups.com.
> >>> >>>> Visit this group at
> >>> >>>> https://groups.google.com/group/kubernetes-users.
> >>> >>>> For more options, visit https://groups.google.com/d/optout.
> >>> >>>
> >>> >>>
> >>> >>
> >>> >
> >>> > --
> >>> > You received this message because you are subscribed to the Google
> >>> > Groups
> >>> > "Kubernetes user discussion and Q&A" group.
> >>> > To unsubscribe from this group and stop receiving emails from it,
> send
> >>> > an
> >>> > email to kubernetes-users+unsubscr...@googlegroups.com.
> >>> > To post to this group, send email to kubernetes-users@googlegroups.
> com.
> >>> > Visit this group at https://groups.google.com/group/kubernetes-users
> .
> >>> > For more options, visit https://groups.google.com/d/optout.
> >>>
> >>> --
> >>> You received this message because you are subscribed to a topic in the
> >>> Google Groups "Kubernetes user discussion and Q&A" group.
> >>> To unsubscribe from this topic, visit
> >>> https://groups.google.com/d/topic/kubernetes-users/
> TpPb25xKlko/unsubscribe.
> >>> To unsubscribe from this group and all its topics, send an email to
> >>> kubernetes-users+unsubscr...@googlegroups.com.
> >>> To post to this group, send email to kubernetes-users@googlegroups.com
> .
> >>> Visit this group at https://groups.google.com/group/kubernetes-users.
> >>> For more options, visit https://groups.google.com/d/optout.
> >>
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Kubernetes user discussion and Q&A" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to kubernetes-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to kubernetes-users@googlegroups.com.
> > Visit this group at https://groups.google.com/group/kubernetes-users.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Kubernetes user discussion and Q&A" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/kubernetes-users/TpPb25xKlko/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> kubernetes-users+unsubscr...@googlegroups.com.
> To post to this group, send email to kubernetes-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/kubernetes-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to