Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing support for mode parameter of tmpfs type volumes #302

Closed
rawtaz opened this issue Sep 4, 2022 · 1 comment · Fixed by #325
Closed

Missing support for mode parameter of tmpfs type volumes #302

rawtaz opened this issue Sep 4, 2022 · 1 comment · Fixed by #325
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@rawtaz
Copy link

rawtaz commented Sep 4, 2022

TL;DR: Docker Compose (at least version 2.x) does not support the mode parameter for tmpfs volume definitions, even though it should.


In the Compose Specification, we find that one should be able to define a filesystem mode for the tmpfs mount. The specification itself contains this parameter at line 409.

However, the compose-go repository's corresponding file does not contain the parameter in the corresponding specification file (it only has the size parameter), see line 401. Nor does the struct support mode, only size.

All this results in that Docker compose version 2.6.0 (which I happen to be running) does not support specifying mode for a tmpfs volume definition, even though https://docs.docker.com/compose/compose-file/ states that "The Compose spec merges the legacy 2.x and 3.x versions, aggregating properties across these formats and is implemented by Compose 1.27.0+."

For example, the following service definition (snippet) errors with services.postgres.volumes.2.tmpfs Additional property mode is not allowed when running docker compose config:

services:
  postgres:
    build: ./postgres/docker
    restart: unless-stopped
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./postgres/docker/init-app-db.sh:/docker-entrypoint-initdb.d/init-app-db.sh:ro
      - type: tmpfs
        target: /run
        tmpfs:
          size: 128k
          mode: 777

(PS: Don't ask me why I "want" to set mode 777 for this tmpfs mount - it's just an evil necessity due to various other limitations.)

@MattKobayashi
Copy link

Hi team, any chance we can get this issue looked at? This is a blocker for a project I'm working on. tmpfs mounts defined by a compose file are given inconsistent permissions (sometimes they're world-writable, other times they're only writable by the owner).

milas added a commit to milas/compose-go that referenced this issue Nov 30, 2022
Schema included `size` for `tmpfs` mounts but not `mode`. This
appears to have been an oversight.

Fixes compose-spec#302.
milas added a commit to milas/compose-go that referenced this issue Nov 30, 2022
Schema included `size` for `tmpfs` mounts but not `mode`. This
appears to have been an oversight.

Fixes compose-spec#302.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
@milas milas self-assigned this Nov 30, 2022
ndeloof added a commit that referenced this issue Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants