I've tried the second version locally, it works fine for me (well, I've
been testing with the ubuntu:trusty image but that doesn't change the
syntax).
The first one gives me a syntax error, but replacing the volumes line
with: volumes: "{{theVolumes|default([])|join(',')}}" fixes it.
What versions of ansible/docker/docker-py are you using? Have you tried
with the latest releases?
On Tuesday, October 14, 2014 6:17:18 PM UTC+2, Chris Roebuck wrote:
>
> Command is from the google cAdvisor docker repo (
> https://github.com/google/cadvisor):
>
> sudo docker run \
> --volume=/:/rootfs:ro \
> --volume=/var/run:/var/run:rw \
> --volume=/sys:/sys:ro \
> --volume=/var/lib/docker/:/var/lib/docker:ro \
> --publish=8080:8080 \
> --detach=true \
> --name=cadvisor \
> google/cadvisor:latest
>
> I tried the following:
>
> - name: 'Start cAdvisor'
> hosts: live
> sudo: yes
> gather_facts: no
> vars:
> theVolumes:
> - '/:/rootfs:ro'
> - '/var/run:/var/run:rw'
> - '/sys:/sys:ro'
> - '/var/lib/docker/:/var/lib/docker:ro'
> tasks:
> - name: "run cAdvisor docker image"
> docker:
> image: google/cadvisor:latest
> name: cadvisor
> volumes: {{ theVolumes }}
> ports: 8080:8080
> state: running
>
> and
>
> - name: 'Start cAdvisor'
> hosts: live
> sudo: yes
> gather_facts: no
> tasks:
> - name: "run cAdvisor docker image"
> docker:
> image: google/cadvisor:latest
> name: cadvisor
> volumes:
> '/:/rootfs:ro,/var/run:/var/run:rw,/sys:/sys:ro,/var/lib/docker/:/var/lib/docker:ro'
> ports: 8080:8080
> state: running
>
> Both methods get the same error from Docker:
>
> TASK: [run cAdvisor docker image]
> *********************************************
> failed: [...] => {"changed": false, "failed": true}
> msg: Docker API error: Cannot start container
> d36a56b68ac91d08ca804a5ee8a230796ed590e11576a0204b5f056d3c74fded: Invalid
> volume specification: /var/lib/docker/:{'bind': '/var/lib/docker', 'ro': True}
>
>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/8f03456f-7854-4377-848c-baa638a8aa3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.