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/ef79fc6d-0d1a-4c9a-b9b8-a4109befc7d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to