[BUG] down -v removes a named volume owned by another project
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 73/100
Hướng nghiên cứu
Start at the down -v volume removal path and compare its ownership handling with the warning emitted by up for a volume labeled with another project name. The issue gives a two project reproduction using the same explicit volume name; run those steps and confirm down -v preserves the other project's volume and warns. No source file or test path is named in the issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
When two projects declare a volume with the same explicit name: (without external: true), docker compose down -v in one project removes the volume that the other project created, along with its data.
up already detects this case. It warns volume "..." already exists but was created for project "proja" (expected "projb") and reuses the volume without touching it. down -v makes no such check: it removes the volume by name, with no warning.
A common way to hit this: the same repository checked out in several directories or git worktrees. Each checkout gets its own project name (from its directory), but a volume name: hard-coded in compose.yaml is the same in all of them.
Current behavior: down -v in projb removes proja's volume (Volume n2-shared-data Removed, exit 0).
Expected behavior: down -v only removes volumes this project owns. For a volume labeled for another project, it skips the volume and warns, just as up warns about it.
Steps To Reproduce
- Create two directories,
proja/andprojb/, each with thiscompose.yaml:services: app: image: alpine:3.20 command: sleep infinity volumes: - data:/data volumes: data: name: n2-shared-data - In
proja/:docker compose up -d && docker compose exec app sh -c 'echo important > /data/file' && docker compose down docker volume inspect -f '{{index .Labels "com.docker.compose.project"}}' n2-shared-dataprintsproja.- In
projb/:docker compose up -d, which prints the warning above (created for project "proja" (expected "projb")). - In
projb/:docker compose down -vprintsVolume n2-shared-data Removed. proja's volume and its data are gone.
Compose Version
Docker Compose version 5.0.1
Docker Environment
Server Version: 29.1.3
Operating System: Docker Desktop
OSType: linux
Architecture: aarch64
Kernel Version: 6.12.54-linuxkit
Storage Driver: overlayfs
Anything else?
No response
- Ngôn ngữ chính
- Go
- Star
- 38.4k
- Fork
- 5.9k
- Merge trung bình
- 1 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 69
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của docker/compose
-
kind/bug status/0-triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] A start failure in one service aborts the start of unrelated services (unreleased regression)Đang mởkind/bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 57/100
docker/compose#14372 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support OSC 7501 progressĐang mởkind/feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
docker/compose#14365 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
kind/feature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
docker/compose#14356 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Epic: Move service selection into the backend API instead of pre-filtering the project in the CLIĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của docker/compose
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
FiloSottile/age#758 ·
-
nginx configĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
Maintainer thường phản hồi trong vòng 1 ngày