简体   繁体   中英

Docker watchtower with private registry

I want to run a docker watchtower to automatically upgrade my docker containers whenever I push a new version to my private registry.

However, watchtower doesn't find containers in my private registry.

Does anyone know how to run watchtower with a private docker registry?

Watchtower maintainer and developer here. We actually do have support for using private registries. This is done by using a fully qualified name as the image name, ie. example.com/my-org/my-image:my-tag , as well as mounting config.json at the watchtower container root.

See the docs, specifically https://containrrr.github.io/watchtower/usage-overview/

The docs could probably be clearer, and if you feel up for the task, feel free to improve them once you get it working.

Thanks, Simon

Update: While this approach still is likely to work, there is native support for this in watchtower.


Watchtower currently only supports the Docker Hub private registry, not off-site registries like Quay or Gitlab.

An alternative might be to use something like webhook and include a HTTP request to an endpoint from whatever CI/CD platform you're using.

That way, instead of checking for updates, you can ping the endpoint whenever a change is made, and auto-update. It's push rather than pull, but it can achieve a similar effect.

An example script for something like running a web server might be:

#!/bin/bash
docker pull [your-registry][repo]:latest
docker stop [repo-name]
docker rm [repo-name]
docker run -d --name [repo-name] -p 80:4000 --restart always [your-registry][repo]:latest

It's not the slickest deployment method. You're probably better to use a dedicated CI/CD provider in production that can better orchestrate the build, testing and deployment pipeline. But it's a quick and dirty way to spawn a staging server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM