Hi folks:
I’ve implemented a proof-of-concept docker connection plugin, so Docker containers can be configured without needing to install ssh or ansible inside of the container itself . You can find it here: https://github.com/lorin/ansible-docker-connection
Take care,
Lorin
Given these are generally used for immutable systems applications can you expand a bit around the use case of “live” containers where you might want to config-manage them?
Thanks!
Sure thing. The use case for this plugin is for somebody who would prefer to use Ansible playbooks instead of Dockerfiles for creating docker images. The way you’d use it is:
- Run a base image Docker container
- Execute an Ansible play (or plays) to configure this container, using the docker connection plugin
- Commit the running container to a new image
For an example playbook that does all three steps, see https://github.com/lorin/ansible-docker-connection/blob/master/ipython.yml
If you wanted to do this today, you’d have to either install an ssh server inside the image first, or install Ansible inside it and use Ansible pull. This plugin gives you a zero-install solution: it uses native docker commands for doing file transfer to/from the container, as well as executing commands inside of the container.
Whether it’s a good idea to use Ansible playbooks as a replacement for Dockerfiles is still unclear to me, but I suspect that there are some folks who want to do it.
Lorin
Sure thing. The use case for this plugin is for somebody who would prefer to use Ansible playbooks instead of Dockerfiles for creating docker images. The way you’d use it is:
- Run a base image Docker container
- Execute an Ansible play (or plays) to configure this container, using the docker connection plugin
- Commit the running container to a new image
For an example playbook that does all three steps, see https://github.com/lorin/ansible-docker-connection/blob/master/ipython.yml
If you wanted to do this today, you’d have to either install an ssh server inside the image first, or install Ansible inside it and use Ansible pull. This plugin gives you a zero-install solution: it uses native docker commands for doing file transfer to/from the container, as well as executing commands inside of the container.
Whether it’s a good idea to use Ansible playbooks as a replacement for Dockerfiles is still unclear to me, but I suspect that there are some folks who want to do it.
I do. Dockerfiles are magnificent in their quirkiness.
“Sure thing. The use case for this plugin is for somebody who would prefer to use Ansible playbooks instead of Dockerfiles for creating docker images. The way you’d use it is:”
I’m not saying what you are doing is wrong, but this is our favored approach for this case - http://www.ansible.com/blog/official-ansible-content-on-docker-hub
“If you wanted to do this today, you’d have to either install an ssh server inside the image first, or install Ansible inside it and use Ansible pull.”
Also not the case, see the above blog
I do like the idea of defining the application in Ansible inside of docker-bash, as it’s great for having a development environment automated that isn’t-docker and you can still use that in prod or not and have an easy way to move between virt tech. Plus I find Ansible a lot easier than bash since I don’t need to remember as much.
It’s also an easy way to work in variables for when things differ between environments.
And I despite bash worse than anything
I agree, and hope to see Lorin's code at
https://github.com/lorin/ansible-docker-connection mature and maybe
become part of the Ansible extras. It would be terrifically useful
compared to the limited Dockerfile syntax.
Ted