Reputation: 1698
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:
Thanks in advance.
Upvotes: 6
Views: 7250
Reputation: 10736
Using ansible shell
module helped:
- name: copy db dump to localhost
ansible.builtin.shell: docker cp container:/tmp/dump.sql /tmp/dump.sql
Upvotes: 2
Reputation: 2150
cp
option.However from my point of view if you wish to copy something into a container you're probably doing something wrong. Containers should be ephemeral.
Upvotes: 1
Reputation: 753
You can also use the synchronize command ~ examples provided in this link:
http://opensolitude.com/2015/05/26/building-docker-images-with-ansible.html
Upvotes: 4