Polls Gitlab image registry for updates for images listed in config.json and updates containers and services using these images. Developed for Ubuntu 18.04, other distributions or operating systems not tested.
Images listed in config.json will be replaced by the new version upon detection of the new version. Services that run outdated images will be cleaned up by removing all stopped containers beloning to the service, after which the service will be force-updated to run the newly pulled image. Running containers belonging to a service will be updated by force-updating the containing service. Containers not belonging to any service will be stopped and removed. For each stopped container a new one wil be ran with the updated image. Stopped containers will be treated the same as running containers. When no running or stopped containers with the image as listed in the config.json are found, upon detection of a new version of the image a single container with this image will be ran.{
"config": {
"interval": <interval-seconds>,
"login": "<gitlab-login>",
"password": "<gitlab-password>"
},
"registries": [
{
"user": "<user-name>",
"project": "<project-name>",
"apiToken": "<api-token>",
"images": [
{
"tag": "<tag>"
}
]
},
{
"user": "<user-name>",
"project": "<project-name>",
"apiToken": "<api-token>",
"images": [
{
"tag": "<tag>"
},
{
"tag": "<tag2>"
}
]
}
]
}version: '3.2'
services:
gitlab-image-refresher:
image: gitlab-image:refresher:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- <path-to-config.json>:/app/config.json
- <path-to-cache.json>:/app/cache.json
- <path-to-log.txt>:/app/cache.json1 To generate Gitlab private API token see: https://gitlab.com/profile/personal_access_tokens
Gitlab Image Refresher requires api rights to work.
2cache.json and log.txt are optional for perseverance, use touch to create empty file.