Skip to content

compose down --volumes never removes named volumes #72

Description

@KennethWKZ

mocker version: 0.7.2 (Homebrew) — macOS, Darwin 25.5.0, arm64

Summary

mocker compose down --volumes (and -v) never removes named volumes. Containers are stopped and removed, the command reports success, and every named volume the project created survives. There is no way to tear a project down completely through the compose interface.

Reproduction

/tmp/mocker-inc/docker-compose.yml:

services:
  hello:
    image: docker.io/library/alpine:3.20
    command: ["sleep","300"]
    volumes:
      - data:/data
volumes:
  data:
$ mocker compose up -d
[+] Running 1/2
 ✔ Container mocker-inc-hello-1             Started

$ mocker volume ls | grep mocker-inc
local    mocker-inc-data

$ mocker compose down --volumes
[+] Running 2/2
 ✔ Container mocker-inc-hello-1             Stopped
 ✔ Container mocker-inc-hello-1             Removed
$ echo $?
0

$ mocker volume ls | grep mocker-inc
local    mocker-inc-data          # still there

The volume is attached to the service and was created by up, so it is unambiguously in the project's scope.

Expected

down --volumes removes named volumes declared in the project's top-level volumes: section (the docker compose down -v contract), reports them in the progress output, and leaves volume ls clean:

$ mocker compose down --volumes
[+] Running 3/3
 ✔ Container mocker-inc-hello-1             Stopped
 ✔ Container mocker-inc-hello-1             Removed
 ✔ Volume mocker-inc-data                   Removed

External volumes (external: true) must of course be left alone, as upstream does.

Secondary observations

  • up progress counter is inconsistent with down's. up prints [+] Running 1/2 with only one line — the volume creation appears to be counted in the denominator but never printed. down --volumes prints [+] Running 2/2 counting only the two container steps, with volumes absent from both numerator and denominator. Whatever the tally is meant to represent, the two commands disagree.
  • Asymmetry in what each command considers project-scoped. In a project whose top-level volumes: block declares 17 volumes, up <service> creates all 17 up front, while down --volumes removes none of them. up and down should agree on the volume set they own.

Filed alongside #69 / #70 / #71 from the same session.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions