[BUG] compose watch stops services using links
and depends_on
with restart: true
#12814
Labels
links
and depends_on
with restart: true
#12814
Uh oh!
There was an error while loading. Please reload this page.
Description
Compose watch mode may currently stop services that link other services without ever restarting:
action: rebuild
).I've specifically encountered this when using legacy
links
between services, but the same behavior can be reproduced when usingdepends_on
withrestart: true
. It's my understanding legacylinks
would basically act likedepends_on
withrestart: true
, despiterestart: false
being the default otherwise.I think it's debatable if the front proxy service needs to be restarted in this example. In either case, it should either be restarted completely or not restarted at all. I don't think stopping the service without restarting it again would ever be intended behavior.
The problem occurred as part of a bigger application using multiple services, but I've been able to reproduce this in a most basic
compose.yaml
file with no external dependencies except a public image. The resulting file may look a bit contrived, but I hope this should be enough to reproduce this without any specific service configurations.Possibly related, I've checked
docker compose up -a
reports the affected services as "exited". Usingdocker compose restart backend
does restart thebackend
and the affected services as expected. However, the runningdocker compose up --watch
session will not pick up the affected services again. This appears to work fine if I do not trigger a rebuild first.I've checked for similar reports and stumbled upon #11695 and #11813, but believe they may point to different, but possibly related, issues.
The recent changes regarding watch mode and watching multiple services as implemented in #12469 and others have been a real game-changer for me personally and a larger number of projects I'm working on, so keep up the great work! 👍
Steps To Reproduce
Basic reproducer:
Reproducer showing two broken services + 2 working ones as possible workarounds:
Start watch mode in foreground:
Change
compose.yaml
file to trigger rebuild:Log output shows backend service is correctly rebuilt, but affected front proxy services stop:
You can see both
nok
andsame
are stopped without restarting.Compose Version
Docker Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: