docker_container recreate doesn't seem to work

192 views
Skip to first unread message

MartinBBG

unread,
Mar 2, 2017, 8:02:54 AM3/2/17
to Ansible Project
I have an docker_container that creates a container with state started (lets called this docker container Service). It has a volume_from another container (lets call that container Volume). When the Volume container changes to a new image, we need to recreate the Service container.

In ansible, I am trying to create a handler that simply has this:

- name: restart Service
  docker_container:
    name: Service
    recreate: yes
    state: started

When I run ansible, I get:

....
            "user": null,
            "uts": null,
            "volume_driver": null,
            "volumes": null,
            "volumes_from": null
        },
        "module_name": "docker_container"
    },
    "msg": "Error creating container: 400 Client Error: Bad Request (\"{\"message\":\"No command specified\"}\")"


Notice the volumes_from is null and so are all the other settings. Seeing this, I tried copying the example in the ansible docker_container docs, and I respecified ALL the options that we have in the task that initially creates the docker container. And it does the exact same thing.

Is there a trick to setting up a task handler that simply recreates the docker container?

Thanks.
Reply all
Reply to author
Forward
0 new messages