I have a scenario where there's a container c1 that is linked to another container c2. According to the readme, when Watchtower detects a new version of c2's image, it should restart c1 as well.
However, after Watchtower successfully stops both containers then updates and restarts c2, it fails to restart c1 with a cryptic "Not found" error message. Then it actually tries to delete c1's image — which is very undesirable since it's only supposed to be restarted, not replaced by an updated version. (Fortunately, the undesirable delete doesn't succeed, though it also doesn't report any errors.)
Here's the log:
time="2016-09-23T22:16:34Z" level=debug msg="Retrieving running containers"
time="2016-09-23T22:16:34Z" level=debug msg="Pulling localhost:5000/test1:latest for /c1"
time="2016-09-23T22:16:34Z" level=debug msg="Pulling localhost:5000/test2:latest for /c2"
time="2016-09-23T22:16:34Z" level=info msg="Found new localhost:5000/test2:latest image (sha256:dcda537d49cd8df308184fd022ec34668cda2f4dfab4417ebc730b3dd57208b1)"
time="2016-09-23T22:16:34Z" level=info msg="Stopping /c1 (fd3a3bbf816dd25b2f8d91000f751b6937f7021dac59fa31f9d84754e1b8096a) with SIGTERM"
time="2016-09-23T22:16:36Z" level=debug msg="Removing container fd3a3bbf816dd25b2f8d91000f751b6937f7021dac59fa31f9d84754e1b8096a"
time="2016-09-23T22:16:36Z" level=info msg="Stopping /c2 (9716e7189ec7fe338feaa7a9f3e91e3deb1072f7a5fd6f538f823d6312639a33) with SIGTERM"
time="2016-09-23T22:16:46Z" level=debug msg="Removing container 9716e7189ec7fe338feaa7a9f3e91e3deb1072f7a5fd6f538f823d6312639a33"
time="2016-09-23T22:16:49Z" level=info msg="Starting /c2"
time="2016-09-23T22:16:50Z" level=debug msg="Starting container /c2 (cd89ea5e1308d66d75b098625a92117a4f8d29d03df03d5bd14757707aad0e6e)"
time="2016-09-23T22:16:54Z" level=info msg="Removing image sha256:a90aaa79b6d4031903b648f12494817426d54cf63bc3a41b26c69a29a843731e"
time="2016-09-23T22:16:54Z" level=info msg="Starting /c1"
time="2016-09-23T22:16:55Z" level=debug msg="Starting container /c1 (bfd966338ec61165934c7b21bbebd04fbdb9e0b9641b7f137f803c60527eda60)"
time="2016-09-23T22:16:55Z" level=error msg="Not found"
time="2016-09-23T22:16:55Z" level=info msg="Removing image sha256:6507b6cfec603dbc3e87292beb5c8cf4a7e98120c586c671992f1cc25b1008e8"
Here's the output of docker ps -a
after this failure:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bfd966338ec6 localhost:5000/test1:latest "node /opt/test" 31 seconds ago Created c1
cd89ea5e1308 localhost:5000/test2:latest "/bin/sh -c 'mv /test" 36 seconds ago Up 31 seconds c2
83fc471a02ec armhfbuild/watchtower "/watchtower --debug " 3 minutes ago Up 2 minutes wt
And here's the output of docker images
:
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost:5000/test2 latest dcda537d49cd 44 minutes ago 6.007 MB
localhost:5000/test1 latest 6507b6cfec60 27 hours ago 25.45 MB
armhfbuild/watchtower latest 93a7c5132e23 7 months ago 7.318 MB
Here's my docker-compose.yml
file:
c1:
container_name: c1
image: localhost:5000/test1:latest
restart: unless-stopped
ports:
- 3000:3000
privileged: true
volumes:
- /dev:/dev:ro
volumes_from:
- c2
links:
- c2
c2:
container_name: c2
image: localhost:5000/test2:latest
restart: unless-stopped
volumes:
- test-volume:/test-volume
wt:
container_name: wt
image: armhfbuild/watchtower
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --debug --interval 30 --cleanup c1 c2