Cli: Support `tmpfs-size` and `tmpfs-mode` in compose-file

Created on 16 Nov 2017  路  7Comments  路  Source: docker/cli

@thaJeztah suggests to use a --mount option as an workaround of --shm-size like that:

docker service create \
  --name tmpfstest \
  --mount type=tmpfs,dst=/dev/shm,tmpfs-size=1000000000 \
  --tty \
  debian:stretch-slim cat

But I can't find anything about how to set the tmpfs-size in the doc about volume-long-syntax. I think this feature should be supported.

areswarm help wanted impaccompose-file kinenhancement

Most helpful comment

Actually the supported mount options are the same as the Linux default mount flags. If you do not specify any options, the systems uses the following options: rw,noexec,nosuid,nodev,size=65536k, it's just that the documentation is incorrect.

This actually does what it's supposed to:

version: "2.4"
services:
  my_app:
    image: my_app
    read_only: true
    restart: always
    tmpfs:
      - /run:mode=770,size=1k,uid=200,gid=10000

It'll set /run mode to 770 with a 1k size limit and owned by uid 200 and gid 10000

All 7 comments

Thanks for opening this!

/cc @vdemeester @dnephin

What are you peeps thinking the docker-compose syntax should look like?

Something like this?

volumes:
    - type: tmpfs
       size: 10000

I think it should match the existing types (bind, volume):

volumes:
 - type: tmpfs
   target: /tmp
   tmpfs:
     size: 10000

Sounds like it's been fixed by https://github.com/docker/cli/pull/808

Looks tmpfs-mode one is not implemented yet. Only tmpfs: size: ... is implemented.

@ypresto could you open a new issue, so that we don't loose sight?

Actually the supported mount options are the same as the Linux default mount flags. If you do not specify any options, the systems uses the following options: rw,noexec,nosuid,nodev,size=65536k, it's just that the documentation is incorrect.

This actually does what it's supposed to:

version: "2.4"
services:
  my_app:
    image: my_app
    read_only: true
    restart: always
    tmpfs:
      - /run:mode=770,size=1k,uid=200,gid=10000

It'll set /run mode to 770 with a 1k size limit and owned by uid 200 and gid 10000

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johanneswuerbach picture johanneswuerbach  路  4Comments

loeffel-io picture loeffel-io  路  4Comments

farmdawgnation picture farmdawgnation  路  3Comments

thaJeztah picture thaJeztah  路  3Comments

bryanhuntesl picture bryanhuntesl  路  3Comments