-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cannot down docker-compose environment with shared network #17990
Comments
So what does docker do here? |
Hi @Luap99, when I
When I
|
What docker-compose version are you using? I observe the following behaviour, docker lets you remove networks when the container is stopped:
This looks like a bug to me, I am using docker v20.10.23. I haven't check with the latest dockerd version. Therefore I would argue podman is correct here, removing this network just results in a broken container. Is there a specific case where you need this to work? |
I can confirm the same behaviour as you observed using docker-compose 2.17.2, the network is not removed. The issue I have is within a library called testcontainers. With Docker you are able to stop/down the environment, whereas with Podman it throws an error. I do not know which is correct, but the difference in behaviour is causing me an issue |
AFAICT compose v1 is deprecated so so you need to move to v2 eventually.
Would switching it to make I understand that this is a difference in behaviour but I cannot see why anyone would want that behaviour, it leaves your container in a broken state. The docker docs even say that you need to disconnect the containers before you can remove the network:
|
Agreed, however both v1 and v2 "work" for my case (error is not thrown from either).
Sorry I don't understand what you mean here
I agree with you, but it seems this is only the case for docker-compose v1. In this issue scenario, for docker-compose v2, Docker leaves the network alone even after down, so the container is not broken. Summary:
I guess the question is whether Podman should adopt docker-compose v2 behaviour, and "successfully" down the environment, leaving behind the network. |
Your reproducer uses stop && down. Why not use down && down? The first container was broken anyway so it was never used again so you can just remove it via down directly.
You want it to leave things around, you only stopped the container so it still exists therefore the network is still required by it. The network is only removed when you down both apps.
compose v2 works against the podman socket because it never calls network rm on it when it knows that the network is still in use. The problem is compose just talk via docker API to us, we cannot know what the intention is. |
The test I have is specifically testing
I think this is the answer for me. I need the change in behaviour in compose v2 for this test to work with Podman. This issue can be closed, thank you for your help @Luap99 |
Issue Description
I have 2 docker-compose apps running with a shared network.
With Docker, I am able to stop 1 app, and then down the 2nd, because stopping the 1st app disconnects the container from the shared network.
With Podman, downing the 2nd app fails because it thinks containers are still connected to the network.
It seems similar to this issue #9632, but in a docker-compose setting.
Steps to reproduce the issue
docker-compose file:
Describe the results you received
Describe the results you expected
Without exporting the
DOCKER_HOST
thus using Docker, no error message is logged. Containers and networks are successfully removed.podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: