-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Volumes of type tmpfs
lacks support for the mode
parameter
#9873
Comments
Same issue I just met the same issue. I'm building a postgres image where I'm using a non root user and tmpfs storage for my PGDATA directory. The error message I got is volumes:
- type: tmpfs
target: /var/lib/postgresql/data
tmpfs:
size: 536870912 # 512 MB I don't have that error with this volume: volumes:
- my_postgres_data:/var/lib/postgresql/data:delegated So linked to After many searches, I've found some docs (like https://docs.docker.com/storage/tmpfs/#specify-tmpfs-options) suggesting to set the mode to According this doc (https://github.com/compose-spec/compose-spec/blob/master/spec.md#long-syntax-4); I should be able to write the portion below in my volumes:
- type: tmpfs
target: /var/lib/postgresql/data
tmpfs:
mode: 1700
size: 536870912 # 512 MB My editor (vscode) is not protesting agains the schema (https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json); seems well valid. |
See compose-spec/compose-go#325 for the acutal spec change. This propagates it to the Engine API object and adds an E2E test via Cucumber 🥒 Fixes docker#9873.
See compose-spec/compose-go#325 for the acutal spec change. This propagates it to the Engine API object and adds an E2E test via Cucumber 🥒 Fixes docker#9873. Signed-off-by: Milas Bowman <milas.bowman@docker.com>
See compose-spec/compose-go#325 for the acutal spec change. This propagates it to the Engine API object and adds an E2E test via Cucumber 🥒 Fixes docker#9873. Signed-off-by: Milas Bowman <milas.bowman@docker.com>
See compose-spec/compose-go#325 for the acutal spec change. This propagates it to the Engine API object and adds an E2E test via Cucumber 🥒 Fixes docker#9873. Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Thank you @milas and @nicksieger 👍 |
Docker Compose currently does not support the
mode
parameter fortmpfs
mounts. It only support thesize
parameter.This has been verified both empirically with
Docker Compose version v2.6.0
withDocker Engine - Community version 20.10.17
and by looking in the source code.Here are some references showing that
mode
is currently not supported:buildTmpfsOptions
function is missing it and even has a comment for it.ServiceVolumeTmpfs
struct is missing it.Worth noting is that Docker does support it in the
mount.TmpfsOptions
struct that is returned by thebuildTmpfsOptions
function in Compose.Also worth mentioning is that the official Docker Compose specification documentation for tmpfs volumes clearly states that
mode
should be supported fortmpfs
. Despite this, however, thecompose-go
library does not support themode
parameter.Here's an example of a
tmpfs
specification for a service that does not work (Compose throws an errorservices.foo.volumes.0.tmpfs Additional property mode is not allowed
):I'm not sure if I got all of the relationships between specifications, libraries and other software right, I figured that given the above mentioned pieces of
mode
throughout the source code, it made sense to open an issue about it in this repository.It looks like it's rather straight forward to add support for this option, since Docker itself supports it, or am I missing something?
Either way, it's a problem because it's currently impossible to mount and use
tmpfs
volumes with unprivileged processes/containers.The text was updated successfully, but these errors were encountered: