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
[BUG] mode attribute in configs works but raises an unsupported warning #14288
changed the title [-][BUG] `configs` block mode working but raises a warning[/-][+][BUG] `mode` attribute in `configs` works but raises an unsupported warning[/+]on Oct 6, 2026
The warning comes from fileReferenceReport in pkg/compose/unsupported_attributes.go. It flags uid, gid and mode on every service-level configs: / secrets: reference as "not supported outside Swarm mode", whatever the source of the config or secret is.
That is only true for some of them. Compose handles them in two ways:
content: and environment: sources are copied into the container as a tar entry (createTar in pkg/compose/secrets.go), which sets the file mode, uid and gid. So these are honored, as the reporter observed.
file: sources are bind-mounted read-only (buildContainerConfigMounts in pkg/compose/create.go). mode, uid and gid really are ignored there, so the warning is correct for them.
Reproduction
I built v5.6.0 (the version in this report) and ran docker compose up -d with mode: 0700, uid: "1234" and gid: "5678" on each reference:
Entry
Warnings
Resulting file
configs with content:
uid, gid, mode
-rwx------ 1234 5678 (applied)
configs with environment:
uid, gid, mode
-rwx------ 1234 5678 (applied)
configs with file:
uid, gid, mode
-rw-r--r-- 0 0 (ignored)
secrets with environment:
uid, gid, mode
-rwx------ 1234 5678 (applied)
secrets with file:
uid, gid, mode
-rw-r--r-- 0 0 (ignored)
So the warning fires for every source, but it's only accurate for file:. secrets: have no content: source in the schema, so that case doesn't exist for them. I ran this on macOS with Docker Desktop (engine 28.3.2), not on Linux as in the report. The code involved is identical between v5.6.0 and current main.
Why it isn't a one-line fix
The check (hasFileReferenceOverride) only sees the service's reference to a config, not the top-level configs: / secrets: definition where content: / environment: / file: is declared. Fixing it means making that information available to the check, for example by filtering the findings once the project is loaded. The tests that assert the current behaviour (pkg/compose/unsupported_attributes_test.go and the e2e scenario in pkg/e2e/unsupported_attributes_test.go) would need updating.
I'm happy to work on a fix if a maintainer is fine with this direction.
@NisargJasani0602 the root cause indeed is that mode / uid / gid are actually supported for secrets/config set by env var on inlined. The restriction is only relevant for file-based resources. Feel free to propose a fix
I have a fix for this ready, and I plan to open a PR for it. It will also close #14283, which has the same root cause (the uid/gid warning on inline configs).
Approach
The warning is only accurate for file: sources, which are bind-mounted, so uid/gid/mode really are ignored there. For content: and environment: sources they are applied. The check can't tell the two apart, because it only sees the service's reference to a config, not the top-level definition. So I filter the findings once the project is loaded, dropping the ones whose source is inline. file: references keep their warning.
I checked it with a real build:
Inline configs and environment secrets print no warning, and get the right mode and owner.
file: sources still warn.
I also added unit tests for inline, environment and mixed sources.
Activity
[-][BUG] `configs` block mode working but raises a warning[/-][+][BUG] `mode` attribute in `configs` works but raises an unsupported warning[/+]NisargJasani0602 commentedon Oct 6, 2026
I looked into this and found the cause.
Cause
The warning comes from
fileReferenceReportinpkg/compose/unsupported_attributes.go. It flagsuid,gidandmodeon every service-levelconfigs:/secrets:reference as "not supported outside Swarm mode", whatever the source of the config or secret is.That is only true for some of them. Compose handles them in two ways:
content:andenvironment:sources are copied into the container as a tar entry (createTarinpkg/compose/secrets.go), which sets the file mode, uid and gid. So these are honored, as the reporter observed.file:sources are bind-mounted read-only (buildContainerConfigMountsinpkg/compose/create.go).mode,uidandgidreally are ignored there, so the warning is correct for them.Reproduction
I built v5.6.0 (the version in this report) and ran
docker compose up -dwithmode: 0700,uid: "1234"andgid: "5678"on each reference:configswithcontent:-rwx------ 1234 5678(applied)configswithenvironment:-rwx------ 1234 5678(applied)configswithfile:-rw-r--r-- 0 0(ignored)secretswithenvironment:-rwx------ 1234 5678(applied)secretswithfile:-rw-r--r-- 0 0(ignored)So the warning fires for every source, but it's only accurate for
file:.secrets:have nocontent:source in the schema, so that case doesn't exist for them. I ran this on macOS with Docker Desktop (engine 28.3.2), not on Linux as in the report. The code involved is identical between v5.6.0 and currentmain.Why it isn't a one-line fix
The check (
hasFileReferenceOverride) only sees the service's reference to a config, not the top-levelconfigs:/secrets:definition wherecontent:/environment:/file:is declared. Fixing it means making that information available to the check, for example by filtering the findings once the project is loaded. The tests that assert the current behaviour (pkg/compose/unsupported_attributes_test.goand the e2e scenario inpkg/e2e/unsupported_attributes_test.go) would need updating.I'm happy to work on a fix if a maintainer is fine with this direction.
ndeloof commentedon Oct 7, 2026
@NisargJasani0602 the root cause indeed is that mode / uid / gid are actually supported for secrets/config set by env var on inlined. The restriction is only relevant for file-based resources. Feel free to propose a fix
ndeloof commentedon Oct 7, 2026
also see #14283
NisargJasani0602 commentedon Oct 7, 2026
I have a fix for this ready, and I plan to open a PR for it. It will also close #14283, which has the same root cause (the
uid/gidwarning on inline configs).Approach
The warning is only accurate for
file:sources, which are bind-mounted, souid/gid/modereally are ignored there. Forcontent:andenvironment:sources they are applied. The check can't tell the two apart, because it only sees the service's reference to a config, not the top-level definition. So I filter the findings once the project is loaded, dropping the ones whose source is inline.file:references keep their warning.I checked it with a real build:
file:sources still warn.I also added unit tests for inline, environment and mixed sources.