You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to increase the size of /dev/shm which seems to be hardcoded to 64Mbyte
in
lxc_template.go
Is it correct that I have to change the value there and recompile docker to get a different value?
It would be helpful to be able to configure it per instnace, e.g some Databasesdo not install without enough shared memory.
Have you tried just overwriting it with -lxc-conf?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/2606#issuecomment-28067688
.
I haven't tried yet, but just use a recompiled docker. Turned out to be easy because docker compiliation is done using a docker image!
I will try to figure out how it works with the command line within the next few days
Open /etc/fstab with vi or any text editor of your choice,
Locate the line of /dev/shm and use the tmpfs size option to specify your expected size,
e.g. 512MB:
tmpfs /dev/shm tmpfs defaults,size=512m 0 0
e.g. 2GB:
tmpfs /dev/shm tmpfs defaults,size=2g 0 0
mount -o remount /dev/shm
Reacted by Andrii Podanenko, Jimmy Breck-McKye, Simon Schick and Bairen Yi
@mansurali901 your method works in the host machine, it doesnt work for docker container. i tried same method but it gives me permission denied error for mount -o remount /dev/shm . i ran it with sudo as well but still container memory is same
@Eyshika@mansurali901 I would highly recommend avoiding the use of --privileged as it will disable (if not all) all protection that containers provide. If you want to set the size for the container, docker run has a --shm-size option. You can also use the --mount option, which allows you to set options for swarm services as well (see #26714 (comment)) for example:
Activity
tianon commentedon Nov 8, 2013
Have you tried just overwriting it with
-lxc-conf?kohlerm commentedon Nov 9, 2013
Thanks, i was not Aware of this Option!
I rebuild my
docker works fine!
Markus
On Fri, Nov 8, 2013 at 3:51 PM, Tianon Gravi [email protected]:
kimsandb commentedon Nov 14, 2013
Hi.
What actual options would do this? I'm having issues with the rootpath.
Kim
jvermillard commentedon Nov 23, 2013
same here, kohlerm do you mind shring the command line you used?
jvermillard commentedon Nov 23, 2013
I tried
without success
In the resulting /proc/mounts :
kohlerm commentedon Nov 24, 2013
I haven't tried yet, but just use a recompiled docker. Turned out to be easy because docker compiliation is done using a docker image!
I will try to figure out how it works with the command line within the next few days
jvermillard commentedon Nov 25, 2013
Maybe this issue should be reopen?
kohlerm commentedon Dec 6, 2013
does not work in 0.7 as well.
I think it might not work because the line in the template contains
{{escapeFstabSpaces $ROOTFS}}/
which is expanded to the full /var/lib/docker path.
jvermillard commentedon Dec 12, 2013
ping: reopen please
tianon commentedon Dec 12, 2013
Yes, it would appear that we need some way to tweak this value, since lxc-conf can't do it.
jvermillard commentedon Jan 8, 2014
proposing #3505 as a fix
24 remaining items
NIWAHideyuki commentedon Sep 17, 2015
Hi,
I hope for the function that the shm memory of a size that is bigger than 64MB can be set.
And, I tried to make it. #16168
Addition of "--shm-size" to which size of /dev/shm is changed when container is made.
Example)
docker run -it --shm-size=256m centos /bin/sh
Signed-off-by: NIWA Hideyuki [email protected]
davidkarlsen commentedon Oct 14, 2015
How to apply this when building images (not running), e.g. docker build?
NIWAHideyuki commentedon Oct 15, 2015
I newly applied optional --shm-size to "docker build" sub command.
davidkarlsen commentedon Oct 15, 2015
@NIWAHideyuki Awesome - what release will it be in?
awartoft commentedon Oct 23, 2015
@NIWAHideyuki I would also like to know that
thaJeztah commentedon Nov 23, 2015
@davidkarlsen @macnibblet the PR was just merged (#16168) and will be part of the 1.10 release
davidkarlsen commentedon Nov 23, 2015
@thaJeztah Awesome - thanks!
TmpFileAllocator: Avoid SIGBUS when /dev/shm is full
TmpFileAllocator: Avoid SIGBUS when /dev/shm is full
mansurali901 commentedon Jul 15, 2016
Temporary increase tmpfs filesystem
e.g. 512MB:
tmpfs /dev/shm tmpfs defaults,size=512m 0 0
e.g. 2GB:
tmpfs /dev/shm tmpfs defaults,size=2g 0 0
mount -o remount /dev/shm
davidthornton commentedon Jul 26, 2017
Is it possible to set this persistently in Docker Cloud?
Eyshika commentedon Jul 10, 2019
@mansurali901 your method works in the host machine, it doesnt work for docker container. i tried same method but it gives me permission denied error for
mount -o remount /dev/shm. i ran it with sudo as well but still container memory is samemansurali901 commentedon Jul 10, 2019
@Eyshika this is happening because your container is working in un privileged mode if you run your container with --privilege mode this will work
thaJeztah commentedon Jul 10, 2019
@Eyshika @mansurali901 I would highly recommend avoiding the use of
--privilegedas it will disable (if not all) all protection that containers provide. If you want to set the size for the container,docker runhas a--shm-sizeoption. You can also use the--mountoption, which allows you to set options for swarm services as well (see #26714 (comment)) for example:Inside the container:
/ # df -h /dev/shm Filesystem Size Used Available Use% Mounted on tmpfs 953.7M 0 953.7M 0% /dev/shm