Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[BUG] `docker compose run` drops the anonymous volumes of a dependency it recreates

Đang mở
#14,357 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@htoyoda18 đang làm issue này rồi.

Từ ngày 17/10/2026.

  • #14358 của @htoyoda18 — đang mở

Đá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ả

kind/bug status/0-triage
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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của docker/compose

Tất cả issue của docker/compose

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.