You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
buildMountOptions warns "should not define bind option" for named volumes carrying only an SELinux relabel flag, which compose itself consumes #14435
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.
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.
I’m Prateek Bhatt, currently working as a DevOps Engineer with 2+ years of professional experience in DevOps.
I went through your report about the incorrect buildMountOptions() warning for named volumes using the SELinux relabel flag.
My understanding is that the bind.selinux field is intentionally used to represent the relabel option, but the current validation logic appears to treat it as an invalid bind option for a named volume.
I would be interested in investigating this behavior, particularly the interaction between volume parsing and mount-option validation.
My initial plan would be to:
Reproduce the warning using the provided short volume syntax.
Trace how the SELinux relabel flag is represented during parsing.
Identify the correct validation layer responsible for the false warning.
Add a regression test at the appropriate layer.
I noticed the reference to the related compose-go issue. Could you please confirm whether the fix should be implemented in docker/compose or compose-go?
If this is still available for contribution, I would appreciate the opportunity to work on it.
Activity
ndeloof commentedon Nov 2, 2026
This is a compose-go parser issue. Potential fix is linked to compose-spec/compose-go#979
Prateekbhatt789 commentedon Nov 8, 2026
Hi @Firer,
I’m Prateek Bhatt, currently working as a DevOps Engineer with 2+ years of professional experience in DevOps.
I went through your report about the incorrect
buildMountOptions()warning for named volumes using the SELinux relabel flag.My understanding is that the
bind.selinuxfield is intentionally used to represent the relabel option, but the current validation logic appears to treat it as an invalid bind option for a named volume.I would be interested in investigating this behavior, particularly the interaction between volume parsing and mount-option validation.
My initial plan would be to:
I noticed the reference to the related
compose-goissue. Could you please confirm whether the fix should be implemented indocker/composeorcompose-go?If this is still available for contribution, I would appreciate the opportunity to work on it.
LinkedIn: https://www.linkedin.com/in/prateek-bhatt-6036b5231
Best regards,
Prateek Bhatt