Skip to content

feat: add the umask service attribute - #942

Merged
ndeloof merged 1 commit into
compose-spec:mainfrom
ndeloof:umask
Oct 21, 2026
Merged

ndeloof merged 1 commit into
compose-spec:mainfrom
ndeloof:umask

Conversation

@ndeloof

@ndeloof ndeloof commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

What this PR does, in one sentence

Adds the umask attribute, so a Compose file can set the file mode creation mask of a container's processes.

Context

Docker 29.8 lets a container be created with an umask (docker run --umask, docker/cli#7108, backed by HostConfig.Umask from moby/moby#53463), applied consistently to the entrypoint, exec and healthcheck processes. Compose files have no way to express it today. The attribute is proposed for the specification in compose-spec#659; this is the matching support in compose-go.

What the PR brings

  • umask is accepted on services, jobs and pre_start init containers, as part of the container specification. A pre_start step inherits the umask of its service unless it declares its own.
  • The value is written like a YAML integer: a leading 0 or a 0o prefix makes it octal, so 077 and 0o77 both mean the octal mask 077 (63), while 77 stays the decimal 77. Strings, interpolated ones included (umask: ${UMASK}), follow the same rule.
  • An explicit umask: 0, which masks no permission bit, is kept distinct from an omitted or null umask, where the runtime default applies. The model exposes it as *uint32, the type the engine uses.
  • Values that do not fit in 32 bits are rejected instead of being silently truncated: the schema bounds integers to 0..4294967295 (the spec proposal only has the lower bound), and out-of-range strings fail when parsed.

The canonical output (config) writes the umask as a plain integer: umask: 077 comes back as umask: 63, which loads to the same value.

Covered by conformance tests in loader/tests/umask_test.go (notations, 0 vs unset, interpolation, override, pre_start inheritance, invalid values).

🤖 Generated with Claude Code

umask sets the initial file mode creation mask of the container's
processes (entrypoint, exec and healthcheck), as proposed by
compose-spec#659 and made available by the engine in docker 29.8
(HostConfig.Umask, docker/cli#7108).

The model keeps a *uint32 so that an explicit `umask: 0`, which masks no
permission bit, stays distinct from an omitted or null umask, where the
runtime default applies. A value is written like a YAML integer: a
leading 0 or a 0o prefix makes it octal, so `077` and `0o77` are 63
while `77` is 77. Strings, including interpolated ones, are parsed the
same way and rejected when they do not fit in 32 bits.

The attribute belongs to the container specification, so it is accepted
by services, jobs and pre_start init containers, and a pre_start step
inherits the umask of its service.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@ndeloof
ndeloof requested a review from glours as a code owner October 14, 2026 06:30
@ndeloof
ndeloof merged commit ddbe099 into compose-spec:main Oct 21, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant