You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Related to: #378 (comment)
Unlike the original issue, which concerns down --volumeswith selected services, this issue concerns anonymous volumes created by Dockerfile VOLUME instructions during a full down --volumes.
When shutting down the containers for the services defined in compose.yaml with the down --volumes command, podman-compose leaves anonymous volumes behind.
Even if the --volumes option is given, the subsequent volume search cannot find anonymous volumes because they do not have the io.podman.compose.project label.
help="Remove named volumes declared in the `volumes` section of the Compose file and "
"anonymous volumes attached to containers.",
If the help text describes the intended behavior, podman-compose should also remove anonymous volumes created from image VOLUME declarations.
Otherwise, it should clarify that --volumes does not remove this type of anonymous volume.
Please share any comments or opinions on this issue.
Describe the issue
Note
Related to: #378 (comment)
Unlike the original issue, which concerns
down --volumeswith selected services, this issue concerns anonymous volumes created by DockerfileVOLUMEinstructions during a fulldown --volumes.When shutting down the containers for the services defined in
compose.yamlwith thedown --volumescommand, podman-compose leaves anonymous volumes behind.Even if the
--volumesoption is given, the subsequent volume search cannot find anonymous volumes because they do not have theio.podman.compose.projectlabel.podman-compose/podman_compose.py
Line 4426 in 4711874
In contrast, Docker Compose removes anonymous volumes when it is invoked with
down --volumes.To Reproduce
Prepare a sample
Dockerfileandcompose.yamlas follows:Execute
podman compose down -vto shut down the services, but the anonymous volume declared byVOLUMEin theDockerfilestill remains:IMO: Preferable behavior
Anonymous volumes attached to the containers should be removed when the
--volumesoption is specified.Actual behavior
The container is removed, but its anonymous volume remains, as shown above.
Possible fix
podman-compose should pass
--volumestopodman rmwhen the--volumesoption is specified, as follows:main...te-horie:podman-compose:down-remove-anonymous-volumes
With this change, the anonymous volume is removed as expected:
Discussion
As @zzgab noted in the previous discussion:
I agree with this opinion.
The help text for
compose downalso says:podman-compose/podman_compose.py
Lines 4993 to 4994 in 4711874
If the help text describes the intended behavior, podman-compose should also remove anonymous volumes created from image
VOLUMEdeclarations.Otherwise, it should clarify that
--volumesdoes not remove this type of anonymous volume.Please share any comments or opinions on this issue.
Thank you!
Environment:
0f6537e9cfa38f6035ac57c1716b6d55dbaf3ca4)