Skip to content

Allow dev/shm size to be configurable in the native driver - #4981

Closed
crosbymichael wants to merge 1 commit into
moby:masterfrom
crosbymichael:shm-size
Closed

crosbymichael wants to merge 1 commit into
moby:masterfrom
crosbymichael:shm-size

Conversation

@crosbymichael

Copy link
Copy Markdown
Contributor

Fixes #2606

Right now it's hard coded to a -o option. I don't know if this is the
best way to do it because the hard coding fs.system.shm.size=512m could
lead to duplication but I like being explicit and with this way we can
easily see all the commands that are supported by the drivers.

I'm up to suggestions on how to handle this?

Can be configured by docker run -o native.fs.system.shm.size=512m busybox mount

Docker-DCO-1.1-Signed-off-by: Michael Crosby [email protected] (github: crosbymichael)

Right now it's hard coded to a -o option.  I don't know if this is the
best way to do it because the hard coding fs.system.shm.size=512m could
lead to duplication but I like being explicit and with this way we can
easily see all the commands that are supported by the drivers.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <[email protected]> (github: crosbymichael)
@vieux

vieux commented Apr 3, 2014

Copy link
Copy Markdown
Contributor

Any way to bump the size with lxc ?

@unclejack

Copy link
Copy Markdown
Contributor

@crosbymichael Can you rebase this PR, please?.

@crosbymichael

Copy link
Copy Markdown
Contributor Author

Closing this now while we work out the options

@wscherphof

Copy link
Copy Markdown

Any options yet?

@stonemaster

Copy link
Copy Markdown

What has been working so far for me was to remount /dev/shm with a bigger size:
umount /dev/shm
mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=128M tmpfs /dev/shm

This has to be done in the start command before anything else has been started, of course.

@wscherphof

Copy link
Copy Markdown

hm, yeah, but that would need run --privileged, right?

@stonemaster

Copy link
Copy Markdown

wscherphof: Unfortunately yes. I've tried it in unprivileged mode but that didn't work.

@wscherphof

Copy link
Copy Markdown

so I'm running privileged as a workaround, while wishing for the feature of being able to enlarge the shared memory without having to run privileged

@sridharlreddy

Copy link
Copy Markdown

Hello, is there any other way available to change the size of /dev/shm? Is there any changed planned in docker master branch?

@rhatdan

rhatdan commented Feb 26, 2015

Copy link
Copy Markdown
Contributor

Was there any movement on this? Being discussed on a different github issue? Our performance guys are running into this problem now with some of their tests. And volume mounting in /dev/shm into the container basically breaks the security separation.

@jeremyeder

Copy link
Copy Markdown

The specific test is Linpack MPI which wants to shove a very large dataset into shared memory.

open("/dev/shm/Intel_MPI_LECnRQ", O_RDWR|O_CREAT|O_EXCL, 0600) = 12
lseek(12, 262847, SEEK_SET)             = 262847
write(12, "\0", 1)                      = -1 ENOSPC (No space left on device)
close(12)                               = 0
write(2, "Fatal error in MPI_Recv: Other M"..., 506) = 506

@rhatdan

rhatdan commented Apr 28, 2015

Copy link
Copy Markdown
Contributor

Sadly this seems to have fallen in importance. We now are looking at adding additional tmpfs to the
container (/run, /tmp, /dev/shm, /dev, /sys/fs/cgroup and /proc/kcore)

docker run -ti -v /etc/localtime:/etc/localtime:rw -ti --rm fedora mount | grep tmpfs

tmpfs on /dev type tmpfs (rw,nosuid,context="system_u:object_r:svirt_sandbox_file_t:s0:c785,c819",mode=755)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,context="system_u:object_r:svirt_sandbox_file_t:s0:c785,c819",size=65536k)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,context="system_u:object_r:svirt_sandbox_file_t:s0:c785,c819")
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noexec,relatime,context="system_u:object_r:svirt_sandbox_file_t:s0:c785,c819")
tmpfs on /sys/fs/cgroup type tmpfs (rw,relatime,context="system_u:object_r:svirt_sandbox_file_t:s0:c785,c819")
tmpfs on /proc/kcore type tmpfs (rw,nosuid,context="system_u:object_r:svirt_sandbox_file_t:s0:c785,c819",mode=755)

If we want to control the amount of memory available on these tmfs we need a mechansm to specify this per mount point from the CLI, or from the daemon config.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bigger /dev/shm

8 participants