compose-spec / compose-go

Reference library for parsing and loading Compose YAML files

Home Page:https://compose-spec.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing support for `mode` parameter of `tmpfs` type volumes

rawtaz opened this issue · comments

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.)

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).