buildMountOptions warns "should not define `bind` option" for named volumes carrying only an SELinux relabel flag, which compose itself consumes
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 62/100
Hướng nghiên cứu
Bắt đầu từ buildMountOptions(), nơi cảnh báo được kích hoạt khi một mount có type là volume và Bind khác nil. Kiểm tra cách buildContainerVolumes() và toBindString() sử dụng v.Bind.SELinux cho các named volume, để cảnh báo chỉ bỏ qua trường hợp Bind chỉ thiết lập SELinux. Giữ cảnh báo cho các trường Bind khác như propagation và create_host_path. Hoàn thành khi một mount z/Z trên named volume không tạo cảnh báo và một mount volume có các trường Bind khác vẫn cảnh báo, được bao phủ bởi các test cho buildMountOptions.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
A named-volume mount written with the documented short syntax vol:/path:z
canonicalises to type: volume + bind: {selinux: z}; bind.selinux is the
compose model's only slot for a relabel flag (volume: {selinux: z} is a schema
error, so there is no long-syntax alternative). buildMountOptions() then warns
unconditionally on volume.Type != VolumeTypeBind && volume.Bind != nil,
so every such mount emits a warning on every container create.
The warning is a false positive here, because compose itself consumes the
option it is warning about: two functions later buildContainerVolumes()
routes plain named-volume mounts through the legacy HostConfig.Binds string
API via toBindString(), which appends v.Bind.SELinux (the modern Mounts
API cannot express relabels). Support for bind.selinux on named volumes was
added deliberately in compose-spec/compose-go#213 (fixing #9072, where the
flags were silently dropped). So the configuration is correct, compose honours
it, and the user is told it is wrong.
Steps to reproduce
services:
probe:
image: busybox:latest
command: ["true"]
volumes:
- probevol:/data:z,rw
volumes:
probevol:
docker compose up prints, once per z/Z-flagged named-volume mount per create:
time="..." level=warning msg="mount of type `volume` should not define `bind` option"
docker inspect confirms the flag was honoured:
Binds: ["proj_probevol:/data:rw,z"].
Expected
No warning when the bind: struct on a type: volume mount sets only
selinux, since that field is both the sole supported spelling and one compose
acts on. A bind: struct setting other fields (propagation,
create_host_path) on a volume mount should keep warning.
Impact
On SELinux-enforcing hosts the flags are load-bearing, so the warning cannot be
avoided by dropping them, and --log-level error suppresses all warnings rather
than this one. Deployment tooling ends up filtering the line out of compose's
stderr. It also breaks machine-readable output for downstream consumers:
ansible-collections/community.docker#846 is the same line failing an event
parser.
Versions
Reproduced on Compose v5.1.3 / Engine 29.4.1 (2026-07-19) and Compose v5.5.0 /
Engine 29.7.2 (2026-09-06). buildMountOptions() on main is unchanged.
- Ngôn ngữ chính
- Go
- Star
- 38.9k
- Fork
- 6k
- Merge trung bình
- 2 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 81
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] `docker compose port` prints `:0` (exit 0) for a port the image exposes but the service does not publishCó thể đã có người làm @ndeloof đã nhận 1 ngày trước. Đang mở
Độ 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
-
[BUG] deploy.restart_policy without condition drops the restart policyCó thể làm lại được @akshat-lakhera đã nhận 25 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
docker/compose#14383 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] up: an optional (required: false) service_healthy dependent is not started when a required dependent shares the failing waitCó thể đã có người làm @ndeloof đã nhận 2 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
docker/compose#14507 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Negative replica count in scale flags (docker compose scale / --scale) is accepted without validationCó thể đã có người làm @arsalanyavari đã nhận 8 ngày trước. Đang mởkind/bug status/approved
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] pre_stop hooks are skipped when up or scale stops a containerCó thể đã có người làm @htoyoda18 đã nhận 11 ngày trước. Đang mởkind/bug status/approved
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 53/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 86/100
fluxcd/notification-controller#1441 ·
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 76/100
OneBusAway/maglev#2145 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
priority/medium status/ready type/chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
discobox-ai/discobox#1357 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
TestPseudoLocaleRemote fails now and then: it types the code before the laptop asks for itCó thể đã có người làm @fzn0x đã nhận hôm nay. Đang mởbug priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
edit_file diff rendering panics on invalid UTF-8 textCó thể đã có người làm @TDnorthgarden đã nhận hôm nay. Đang mởarea/tui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
docker/docker-agent#4955 ·
Maintainer thường phản hồi trong vòng 1 ngày