Auto Deploy Containers with Watchtower

The docker default orchestration has limitations. The docker daemon doesn't watch your registry for newer images and pull them to do rolling updates without downtime. You might have to use Kubernetes for such features.

I have been looking for a simpler solution to quickly pull and deploy containers that are created by the developers manually or CI system automation. Watchtower is good solution that is simple to use. Just add the following lines into your docker-compose service section. Adjust watchtower poll interval(default 24 hours) to set how frequently watchtower checks for new images.

 watchtower:
    image: containrrr/watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command: --interval 1800

See collective/training-deploy-project for full example of docker-compose. Thank you @ericof !

There might be other simpler solutions out there that I might not be aware of. Please do share. Thanks!

3 Likes

I will update the training with some examples using docker stack and docker swarm, as this is the way I've been doing things these days.
But thank you for sharing this!

That would be wonderful! Looking forward to the training updates.

I'll continue to share any snippets and recipes that could help the community save time and be more productive with deployments.