[BUG] `docker compose run` drops the anonymous volumes of a dependency it recreates
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
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- docker, docker-compose, go
- Lĩnh vực
- devops, infrastructure
Hướng nghiên cứu
Trace the implementation of docker compose run when it recreates a dependency, focusing on how anonymous volumes are transferred between container generations; compare that path with docker compose up. Use the provided Compose YAML and commands to reproduce the lost data, then add or update tests confirming that run preserves dependency volumes. This work is already being addressed by linked pull request #14358.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
When docker compose run recreates a dependency whose configuration changed, the new container gets fresh, empty anonymous volumes instead of the old ones. A database dependency (any image declaring VOLUME, e.g. postgres or mysql) then looks wiped. docker compose up carries the same anonymous volumes over to the recreated container, so the data stays.
The data is not deleted: the previous anonymous volume is left dangling, so it can still be recovered by hand, but docker volume prune would remove it.
Expected: run keeps the anonymous volumes of a recreated dependency, as up does.
Steps To Reproduce
services:
app:
image: alpine
command: echo done
depends_on: [db]
db:
image: alpine
command: sleep infinity
volumes:
- /data # anonymous volume
environment:
TAG: ${TAG:-one}
$ docker compose up -d db
$ docker compose exec db sh -c 'echo hello > /data/file'
$ TAG=two docker compose run --rm app # db's config changed, so db is recreated
$ docker compose exec db cat /data/file
cat: can't open '/data/file': No such file or directory
With TAG=two docker compose up -d db instead of run, the last command prints hello.
Compose Version
Docker Compose version 5.0.1
Also reproduced on main (289d8a037).
Docker Environment
Docker Engine 29.1.3 (linux/arm64, Docker Desktop on macOS)
Anything else?
No response
- Ngôn ngữ chính
- Go
- Star
- 38.4k
- Fork
- 5.9k
- Merge trung bình
- 2 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 66
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
-
[BUG] `watch` rebuilds in an endless loop when the watched path contains `.git`Có thể đã có người làm @htoyoda18 đã nhận 1 ngày trước. Đang mởkind/bug status/0-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
docker/compose#14362 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
kind/feature status/0-triage
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
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
-
Watch: exec modeCó thể đã có người làm @glours đã nhận 8 ngày trước. Đang mởkind/feature
docker/compose#14326 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Restore build concurrency limit now that bake supports itCó thể đã có người làm @maxproske đã nhận 4 ngày trước. Đang mởkind/feature
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/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 76/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 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
bug
Độ 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 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
devlikeapro/waha#2322 ·
Maintainer thường phản hồi trong vòng 2 ngày