containers / containers/podman-compose
`run --rm` does not remove anonymous volumes (leaks one volume per mount)
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
**Description**
`podman-compose run --rm` removes the one-off container but leaves its
anonymous volumes behind. Every run leaks one volume per `- /path` mount
(verified: 3 mounts → 3 orphans). Docker Compose fixed the identical gap in
[docker/compose#9319](https://github.com/docker/compose/issues/9319)
(shipped v2.3.4); podman-compose still has it on current builds.
This is the `run`-path counterpart to #1521 (fixed for `down --volumes`
by #1553) — same class of leak, different command.
**To Reproduce**
```yaml
# compose.yaml
services:
t:
image: docker.io/library/alpine:latest
command: ["true"]
volumes:
- /data1
- /data2
- /data3
```
```console
$ podman volume ls # empty baseline
$ podman-compose run --rm t # exit 0
$ podman volume ls # 3 orphaned anonymous volumes, one per mount
```
**Expected behavior**
Like `docker compose run --rm` (≥2.3.4) and `podman run --rm`: the anonymous
volumes are removed together with the container on clean exit. No new volumes
left behind.
**Actual behavior**
One orphaned anonymous volume per `- /path` mount, exit code 0, no warning.
Requires manual `podman volume prune` to clean up.
**Environment**
- `podman-compose version 1.6.0`, `podman version 5.8.6`
- OS: NixOS (x86_64)
Happy to open a PR mirroring the #1553 approach for the `run` path if
maintainers agree on the direction.
Contributor guide
Research direction
Reproduce the leak with the provided compose.yaml and `podman-compose run --rm t`, then trace the `run --rm` entry point and compare it with the #1553 approach for `down --volumes`. Done means a clean exit removes the one-off container and all anonymous volumes created for its mounts, with no volumes left in `podman volume ls`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100