Any final  prognosis on this issue? Specfically, how should the volumes be 
specified. An example would be nice!
I'm urgently waiting to use this feature.
--BK

On Tuesday, August 26, 2014 3:05:49 PM UTC-4, Steven Truong wrote:
>
> Hi all,
>
> I tried to use the volumes option and nothing seems to work for me.
>   
> I want to mount 2 directories ~/dockerstorage/model and ~/repo/ops/ansible 
> to the container and I used either of these commands and nothing worked.
>
>  docker: image=registry.my.com:5000/steven/centos65_prod_ready:v1 
> docker_url=tcp://{{ ansible_default_ipv4.address }}:7777 
> publish_all_ports=True state=running volumes=/home/kafka/models:{{ 
> myhome.stdout }}/dockerstorage/models:rw,/usr/local/src/ansible:{{ 
> myhome.stdout }}/repo/ops/ansible:ro   
>
>  docker: image=registry.my.com:5000/steven/centos65_prod_ready:v1 
> docker_url=tcp://{{ ansible_default_ipv4.address }}:7777 
> publish_all_ports=True state=running volumes={{ myhome.stdout 
> }}/dockerstorage/models:/home/kafka/models:rw,{{ myhome.stdout 
> }}/repo/ops/ansible:/usr/local/src/ansible:ro
>
> I sshed into the containers and the mounted points in either case were all 
> empty.
>
> I ran using docker directly and it worked for me:
>
>
>
> docker run -d -P  -v /home/steven/dockerstorage/models:/home/kafka/models:rw 
> -v /home/steven/repo/ops/ansible:/usr/local/src/ansible:ro 
> registry.my.com:5000/steven/centos65_prod_ready:v1
>
>
>
>
> Please let me know what is the right ways to use "volumes" for docker. 
>  From the comments in the docker module, it appears to me that the 
> /mnt:/tmp is in reversed orders from those of the docker command line 
> because of the case when we just want to create a volume such as /mnt and 
> there is no equivalent mounted point from the host.  I think that this is 
> confusing and users have to read the codes to find out.
>
> Thanks,
> Steven.
>
> [root@sc2-dock1 cloud]# pwd
> /usr/local/ansible/library/cloud
>
>
> class DockerManager:
>
>     counters = {'created':0, 'started':0, 'stopped':0, 'killed':0, 
> 'removed':0, 'restarted':0, 'pull':0}
>
>     def __init__(self, module):
>         self.module = module  
>
>         self.binds = None
>         self.volumes = None
>         if self.module.params.get('volumes'):
>             self.binds = {}
>             self.volumes = {}
>             vols = self.module.params.get('volumes')
>             for vol in vols:
>                 parts = vol.split(":")
>                 # host mount (e.g. /mnt:/tmp, bind mounts host's /tmp to 
> /mnt in the container)
>                 if len(parts) == 2:
>                     self.volumes[parts[1]] = {}
>                     self.binds[parts[0]] = parts[1]
>                 # docker mount (e.g. /www, mounts a docker volume /www on 
> the container at the same location)
>                 else:
>                     self.volumes[parts[0]] = {}
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/19d5af4f-b740-4962-8066-8346f3105247%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to