Skip to content

Conversation

NIWAHideyuki
Copy link

Addition of "--shm-size" to which size of /dev/shm is changed.
It relates to #2606 , #3505 and #4981.

fix #2606
fix #3505
fix #4981

  • Optional "--shm-size=" was added to the run sub-command.
  • The size of /dev/shm in the container can be changed when container is made.
  • Being able to specify is a numerical value that applies number, b, k, m, and g.
  • The default value is 64MB, when this option is not set.
  • It deals with both native and lxc drivers.

Signed-off-by: NIWA Hideyuki niwa.hiedyuki@jp.fujitsu.com

@cpuguy83
Copy link
Member

cpuguy83 commented Sep 9, 2015

Looks like you need to run gofmt -s -w on your changes.
Also tests would be helpful.

@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 10, 2015
@GordonTheTurtle GordonTheTurtle removed the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 11, 2015
@bastih
Copy link

bastih commented Sep 11, 2015

Can we have this for docker build as well?

@NIWAHideyuki
Copy link
Author

The size of shm is specified into "run and create".
I would like to try "build" next.

@bastih
Copy link

bastih commented Sep 14, 2015

That would be awesome, we are currently using a custom build just to adjust shared memory during build time so we can run a program that needs more than the default amount of shared memory. Would be lovely to remove our hard-coded customizations.

@NIWAHideyuki NIWAHideyuki force-pushed the 16164-shm-size branch 2 times, most recently from eb72c60 to 24acf55 Compare September 16, 2015 23:56
@NIWAHideyuki NIWAHideyuki mentioned this pull request Sep 17, 2015
@NIWAHideyuki NIWAHideyuki force-pushed the 16164-shm-size branch 10 times, most recently from 3bf2e9e to 57ecd52 Compare October 2, 2015 00:14
@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Oct 2, 2015
@GordonTheTurtle GordonTheTurtle removed the dco/no Automatically set by a bot when one of the commits lacks proper signature label Oct 2, 2015
@NIWAHideyuki NIWAHideyuki force-pushed the 16164-shm-size branch 2 times, most recently from ab3a634 to 740e665 Compare October 2, 2015 07:43
@jessfraz
Copy link
Contributor

jessfraz commented Oct 2, 2015

lets do run and create for now, design lgtm moving to code review

rhatdan pushed a commit to projectatomic/docker that referenced this pull request Nov 24, 2015
Backport of Docker's upstream
moby#16168

Signed-off-by: Antonio Murdaca <runcom@redhat.com>

Signed-off-by: NIWA Hideyuki <niwa.niwa@nifty.ne.jp>
rhatdan pushed a commit to rhatdan/moby1 that referenced this pull request Jan 22, 2016
Backport of Docker's upstream
moby#16168

Signed-off-by: Antonio Murdaca <runcom@redhat.com>

Signed-off-by: NIWA Hideyuki <niwa.niwa@nifty.ne.jp>
rhatdan pushed a commit to projectatomic/docker that referenced this pull request Jan 26, 2016
Backport of Docker's upstream
moby#16168

Signed-off-by: Antonio Murdaca <runcom@redhat.com>

Signed-off-by: NIWA Hideyuki <niwa.niwa@nifty.ne.jp>
nubs added a commit to nubs/docker-py that referenced this pull request Feb 4, 2016
--shm-size was added to Docker in 1.10 via moby/moby#16168.  See
docker/compose#2823 for more details.

Signed-off-by: Spencer Rinehart <anubis@overthemonkey.com>
nubs added a commit to nubs/docker-py that referenced this pull request Feb 4, 2016
--shm-size was added to Docker in 1.10 via moby/moby#16168.  See
docker/compose#2823 for more details.

Signed-off-by: Spencer Rinehart <anubis@overthemonkey.com>
@lifubang
Copy link
Contributor

I have to run a bash script in /dev/shm, but the server said 'Permission denied'.
When I use mount command, the result is:
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=1048576k)
My question is how to make /dev/shm have exec permission?
Thanks.

我修改了源代码,把NOEXEC去掉了,可以了。
建议下一版能提供NOEXEC的开关。

@grooverdan
Copy link
Contributor

@lifubang - currently not possible - https://github.com/docker/docker/blob/master/daemon/container_operations_unix.go#L1048 - raise a separate issue if you can't find one already. Issues aren't a support request forum.

@grooverdan
Copy link
Contributor

@lifubang #18855 #18853 (comment)

@kopax
Copy link

kopax commented Jun 28, 2016

--shm-size=512m is not working for me as build args, either as run args.

            docker run -it --shm-size=102400 ubuntu:14.04.4
    root@141a66888d0a:/# cat /proc/mounts | grep shm
    shm /dev/shm tmpfs rw,nosuid,nodev,noexec,relatime,size=100k 0 0
    root@141a66888d0a:/# ipcs -lm

    ------ Shared Memory Limits --------
    max number of segments = 4096
    max seg size (kbytes) = 32768
    max total shared memory (kbytes) = 8388608
    min seg size (bytes) = 1

Install details

    docker version
    Client:
     Version:      1.11.0
     API version:  1.23
     Go version:   go1.5.4
     Git commit:   4dc5990
     Built:        Wed Apr 13 18:17:17 2016
     OS/Arch:      linux/amd64

    Server:
     Version:      1.11.0
     API version:  1.23
     Go version:   go1.5.4
     Git commit:   4dc5990
     Built:        Wed Apr 13 18:17:17 2016
     OS/Arch:      linux/amd64


    uname -a
    Linux master-bhs-01 3.14.32-xxxx-grs-ipv6-64 #7 SMP Wed Jan 27 18:05:09 CET 2016 x86_64 GNU/Linux

I have tried lot's of way to set this value and I am completely stuck finding no way to configure it for using with gitlab.

I have started this issue, I post it here because it's a bit related to what I am trying to achieve : https://gitlab.com/gitlab-org/omnibus-gitlab/issues/1381

@thaJeztah
Copy link
Member

@kopax can you open a new issue for that? it's ok to add a link to this PR for reference

@kopax
Copy link

kopax commented Jun 28, 2016

Sure, here is the topic : #24040

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

Successfully merging this pull request may close these issues.

bigger /dev/shm