Automate Installing Docker and Docker Compose With Ansible
I'm sure at some point you'll want to install Docker and Docker Compose on your production server, and Ansible makes it easy.
Quick Jump: Where Did This Article Go?
I’m a huge fan of using Docker and Ansible together, so it’s no surprise that I let Ansible handle installing Docker and Docker Compose in production.
Where Did This Article Go?
For a while now I’ve duplicated most of the role’s README file in this article, but trying to keep track of the changes in 2 spots got a little tedious.
Here’s the TL;DR on what the Ansible Docker role does:
- Install Docker (editions, channels and version pinning are all supported)
- Install Docker Compose using PIP (version pinning is supported)
- Install the
dockerPIP package so Ansible’s
- Manage Docker registry login credentials
- Configure 1 or more users to run Docker without needing root access
- Configure the Docker daemon’s options and environment variables
- Configure a cron job to run Docker clean up commands
You can check out the full details on GitHub.
And if you’re wondering, yes, I am using it in production.
Let me know how it goes in the comments.