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

Support tmpfs-size and tmpfs-mode in compose-file #698

Closed
luochen1990 opened this issue Nov 16, 2017 · 9 comments
Closed

Support tmpfs-size and tmpfs-mode in compose-file #698

luochen1990 opened this issue Nov 16, 2017 · 9 comments

Comments

@luochen1990
Copy link

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

@thaJeztah
Copy link
Member

Thanks for opening this!

/cc @vdemeester @dnephin

@glyif
Copy link

glyif commented Jan 2, 2018

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

Something like this?

volumes:
    - type: tmpfs
       size: 10000

@dnephin
Copy link
Contributor

dnephin commented Jan 2, 2018

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

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

@vdemeester
Copy link
Collaborator

Sounds like it's been fixed by #808

@thaJeztah thaJeztah added this to the 18.02.0 milestone Apr 24, 2018
@ypresto
Copy link

ypresto commented Jul 25, 2018

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

@thaJeztah
Copy link
Member

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

@mterron
Copy link

mterron commented Oct 15, 2018

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

@alisonjr
Copy link

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

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

Is this configuration valid?

@lordraiden
Copy link

lordraiden commented Oct 5, 2023

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

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

Is this configuration valid?

for me it does not work, or at least is not using /dev/shm

this works I can validate it looking with this command "df -h" looking to the increase space used by shm

  • /dev/shm:/transcode
    but you can't limit the size

Is there a command or something to see how tmpfs is filling?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants