New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
restart behavior when using network_mode: service #10263
Comments
(this is on compose 2.15.1) (also, it took me quite a while to figure out why my containers were randomly breaking, though it made sense once i figured out the repro case) |
@ndeloof Does that change apply to the case where the first container is restarted using autoheal? Your doc says:
|
Hi, I realise this is an old issue, but I wondered about this
vs
If a dependent service restarts because of failure, exit, termination or "autoheal" as mentioned above, the service which depends on it, should also be restarted. I notice it currently only applies after a manual docker-compose-restart or as the result of a configuration change. In my case, the "depends_on" is accompanied by a "network_mode: service:<dependent_service>", which means the Is there a way to express this requirement in the current implementation? Thanks |
@systemmonkey42 compose only can manage restart triggered by an explicit command, (auto)restart after container failure is handled by docker engine, which doesn't have such a "dependencies" logic. |
Makes sense. I ended up using a simple healthcheck which determines if the default route has disappeared, combined with an autoheal container. Thanks for the response, and sorry for the noise. |
Repro Steps
docker compose up -d
curl localhost:8800
-> returns "ok"docker compose restart pause
curl localhost:8800
Expected Result
Server returns "ok"
Actual Result
Unable to connect
Additional context
Sometimes I work with services that need to speak to each other on localhost. So I use Pod-like networking so that all my containers can reach each other. There's a pause container that sets up the network namespace, and the other compose services join to that pause container. That's what this compose file is implementing.
But suppose I want to expose a new port on the network. I add it to the pause service and run
docker compose restart pause
.Oops! everything is now broken, because bba's network got disconnected from the pause container.
If I restart bba, the container works again.
I'm not sure what feature I'm actually asking for here. Maybe we should auto-restart 'bba' when the pause container restarts? Not sure.
[edit - rewrote the ticket to be a bit more structured]
The text was updated successfully, but these errors were encountered: