Automatically update Docker containers using webhooks
I have created a Github repo and a Docker repo. Both work together very well: when I push a new version of Dockerfile to Github, a new image is automatically built inside the Docker repo.
Now, I'd like to have my running containers automatically updated when the base-image is (re)built.
How can I achieve it using Docker repos webhooks?
Solution 1:
The Century Link Labs team have developed a 2 new open source tools that can use web hooks to update running containers.
Their 1st app is Zodiac that uses a "push" deployment model. Its a lightweight tool built on top of Docker Compose, for easy deployment and rollback of dockerized applications. It maintains a history of all deployments that also allows you to rollback to a previous deployment.
- Zodiac: Easy Container Deployment & Rollback
- GitHub Project
Their 2nd app Watchtower uses a "pull" deployment model. This model allows Docker containers that reside behind a firewall to detect and more safely pull changes without exposing an external port.
Watchtower knows how to properly restart a set of linked containers. If an update is detected for one of the dependencies in a group of linked containers, Watchtower will stop and start all of the containers in the correct order so that the application comes back up correctly.
- Watchtower: Automatic Updates for Docker Containers
- GitHub Project
I have no affiliation with Century Link Labs.
Another simpler app you might want to have a look at is Docker Puller.
- Automatically pull updated Docker images and restart containers with docker-puller
- Github Project