dockeransiblecpdocker-cp

Ansible docker module missing CP command?


The docker client offers the cp sub-command as explained here, which is very handy when one needs to copy a file into a container (note: this is somewhat analogous to Dockerfile ADD instruction in image building). In Docker 1.8 the cp command has been even expanded a bit.

However, reading the Ansible docker module documentation, it appears that this is missing? Here are my 2 questions:

  1. Did I misunderstand the Ansible documentation?
  2. if Ansible is missing the cp thing, has anyone found a workaround? I can think of something like using Ansible copy module to transport the files to the remote machine first, and then run there the native docker client with cp, but ideally Ansible's docker module would have done this in a single shot as part of the docker module?

Thanks in advance.


Solution

  • You can also use the synchronize command ~ examples provided in this link:

    http://opensolitude.com/2015/05/26/building-docker-images-with-ansible.html