Sometimes, I have to copy files into running docker container.
Would it make sense to add option to “docker_container” module, for example “cp_file”?
If so, how can I contribute?
Thanks,
You can already do this. The proper solution would be to use the docker connection type and just use the copy module.
http://docs.ansible.com/ansible/intro_inventory.html#non-ssh-connection-types
Hi Matt,
The docker container is running on the remote host.
Currently I have 2 tasks:
- copy file to the remote host;
- copy file into docker container, using shell task with “docker cp” command.
I have to use ssh connection type in order to connect to the remote host.
I guess, it would be convenient to have an option in docker_container module to copy file from management host to docker container running on remote host.
What is your opinion?
I think that you can also already do what you’re explaining . But you have to expose the docker socket as a TCP one , so you can just add you remote docker host as decribed here:
http://docs.ansible.com/ansible/latest/intro_inventory.html#non-ssh-connection-types
https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-socket-option