Refresh images of running containers using a webhook
581
Source code: https://github.com/Uni-Fo/docker-image-refresh
If you work with docker and continuous integrations tools, you might need to update your images on your servers as soon as your build is finished. If tools like [Watchtower] (https://github.com/containrrr/watchtower) don't cover your needs, maybe this will fit. Suitable for homelabs, local development. Probably not something to put into production environments. Use at your own risk. No warranty provided.
This tool is a tiny webserver listening for a POST and automatically update the specified image using Docker API.
You just have to run the image on your server, and configure your CI tool.
Launch the image on your server, where the images you want to update are
docker run -d \
--name docker-image-refresh \
--env TOKEN=abcd4242 \
--env REGISTRY_USERNAME=uni \
--env REGISTRY_PASSWORD=password \
--env REGISTRY_URL=https://some.regitry.fo \
-p 8080:8080 \
-v /var/run/docker.sock:/var/run/docker.sock \
wirednerd/docker-image-refresh:latest
Available env variable:
TOKEN*
REGISTRY_USERNAME
REGISTRY_PASSWORD
REGISTRY_URL (default: https://index.docker.io/v1/)
HOST (default: 0.0.0.0)
PORT (default: 8080)
DEBUG (default: False)
* mandatory variables. For TOKEN You can generate a random string, it's a security measure.
After running the container, you can make request to the server.
How to make a request from your CI pipeline:
curl -v -X POST \
"https://docker-image-refresh:8080/images/pull" \
-F "token=$WEBHOOK_TOKEN" \
-F "restart_containers=true" \
-F "repository=$IMAGE" \
-F "tag=$TAG"
replace $WEBHOOK_TOKEN, $IMAGE and $TAG as needed. Tag is optional.
You can access container logs with
docker logs --follow docker-image-refresh
Content type
Image
Digest
sha256:2890529c7…
Size
23.9 MB
Last updated
over 1 year ago
docker pull wirednerd/docker-image-refresh