compose-go icon indicating copy to clipboard operation
compose-go copied to clipboard

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

Open rawtaz opened this issue 3 years ago • 0 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.)

rawtaz avatar Sep 04 '22 19:09 rawtaz