[Bug]: SOME Docker Compose `configs:` are not persisted
Bug Report Checklist
- I checked existing issues and found no duplicates.
- I have reviewed Watchtower's documentation and confirmed compliance with documented configuration specifications.
- I have restarted Docker, re-pulled the
latestimage, and confirmed that the issue persists.
Bug Description
Hi. While there is new com.centurylinklabs.watchtower.copy-file it's working not as good as it should.
Paths that are already bind mounts or volumes are skipped that rule makes no sense to be honest. Besides, official docker compose still overwrites such files.
Real life example. I have an SearXNG instance where I need to mount /etc/searxng/settings.yml file. While that, /etc/searxng declared as a VOLUME inside of the Dockerfile. BUT I have no named volume or a bind at that path, docker creates temporary unnamed volume instead. So, settings are missing on the image update. Ofc, stack redeploy will fix that until next update.
A missing path is skipped. Same problem. If we are speaking about missing PARENT FOLDERS as well. I have a container where a config mounted at /config/config.yml. The thing is that /config is not exists. Compose creates it automatically while watchtower does not, halting container recreation with an error:
msg="Updated container state to failed" error="failed to create container: failed to copy file into new container: /config/config.yml: Error response from daemon: Could not find the file /config in container ..."
I might have missed some other edge cases. But those 2 are my personal pain points.
Steps to Reproduce
- Deploy a stack with
configs:mounted under some VOLUME mount point and / or non-existent parent folder. - Wait for update cycle.
Expected Behavior
Watchtower should replicate docker-compose logic for such file.
Watchtower Version
1.22.3
Docker Version
Client: Docker Engine - Community
Version: 28.3.2
API version: 1.51
Go version: go1.24.5
Git commit: 578ccf6
Built: Wed Jul 9 16:13:45 2025
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 28.3.2
API version: 1.51 (minimum version 1.24)
Go version: go1.24.5
Git commit: e77ff99
Built: Wed Jul 9 16:13:45 2025
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.27
GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da
runc:
Version: 1.2.5
GitCommit: v1.2.5-0-g59923ef
docker-init:
Version: 0.19.0
GitCommit: de40ad0Docker Info (optional)
Docker Compose Configuration
services:
app:
image: nickfedor/watchtower:latest
restart: unless-stopped
environment:
- TZ=Etc/UTC
- WATCHTOWER_SCHEDULE=0 0 2 * * *
- WATCHTOWER_CLEANUP=true
- WATCHTOWER_INCLUDE_RESTARTING=true
- WATCHTOWER_REMOVE_VOLUMES=true
volumes:
- /var/run/docker.sock:/var/run/docker.sockDocker CLI Command
Debug Logs
Sorry, used images takes days to update. Setting up fully self-contained env for such logs will take time. I will do that if it will really help to resolve the bugs. Just tell me to
Additional Context
No response
Source: nicholas-fedor/watchtower