-
Notifications
You must be signed in to change notification settings - Fork 101
Description
Docker Compose assumes the latest tag when the image: attribute is missing a tag or digest, e.g. given
# ~/docker/proxy/compose.yaml
services:
nginx:
image: nginx
labels:
wud.watch: true
wud.watch.digest: true
wud.tag.include: ^latest$The command docker compose pull nginx would pull the nginx:latest image from the Docker Hub default repository.
WUD's watcher successfully detects when the image needs updating. However, WUD's dockercompose trigger fails to pull the image and restart the container.
# ~/docker/wud/compose.yaml
services:
whatsupdocker:
image: getwud/wud
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ../proxy/compose.yaml:/docker/proxy/compose.yaml
ports:
- 3000:3000
environment:
# Local Docker watcher - Scan every hour
- WUD_WATCHER_LOCAL_CRON=0 * * * *
- WUD_WATCHER_LOCAL_SOCKET=/var/run/docker.sock
- WUD_WATCHER_LOCAL_WATCHBYDEFAULT=false
- WUD_TRIGGER_DOCKERCOMPOSE_PROXY_FILE=/docker/proxy/compose.yamlThis happens because in
wud/app/triggers/providers/dockercompose/Dockercompose.js
Lines 12 to 25 in 7e579d2
| function doesContainerBelongToCompose(compose, container) { | |
| // Get registry configuration | |
| const registry = getState().registry[container.image.registry.name]; | |
| // Rebuild image definition string | |
| const currentImage = registry.getImageFullName( | |
| container.image, | |
| container.image.tag.value, | |
| ); | |
| return Object.keys(compose.services).some((key) => { | |
| const service = compose.services[key]; | |
| return service.image.includes(currentImage); | |
| }); | |
| } |
currentImage will end with the explicit :latest tag, but service.image might not, as it refers to the real value of the image attribute in the compose.yaml file. Hence, there won't be a match in L23 unless the image explicitly includes the :latest tag.
The expected behavior:
- WUD should pull the image and update the container, regardless of the optional
:latesttag. - It should not update the
compose.yamlfile fromimage: nginxtoimage: nginx:latest.
A temporary workaround is to explicitly add the :latest tag to all such images.
See also: #775