i4nk1t
i4nk1t

Reputation: 497

How to set POSIX message queues limit to unlimited in docker container using --ulimit option

How to set the POSIX message queues limit as unlimited for docker container.

I know that --ulimit is an option that can be used along with docker run, but i'm not quite sure on how to use the --ulimit option along with docker run for POSIX message queues.

tried following but did not work:
docker run -it --ulimit msgqueue=unlimited

Also tried following within container
ulimit -q unlimited

error: Operation not permitted

Upvotes: 2

Views: 3517

Answers (3)

karsten
karsten

Reputation: 693

I use it together with other parameters:

docker run    -u "$(id -u)":"$(id -g)" \
          --sysctl fs.mqueue.queues_max=1024 \
          --sysctl fs.mqueue.msg_max=512 \
          --ulimit msgqueue=-1  \
....

If I open a second root Window (docker exec -it -u 0 bash) and set it there (ulimit -q unlimited) it works in this window only, which is not useful...

Upvotes: 0

avivr
avivr

Reputation: 1523

You can set POSIX message queues size to unlimited like this: docker run --ulimit msgqueue=-1. Tested it on Docker version 20.10.5.

Within the container, you can confirm that it's indeed unlimited by running ulimit -a:

root@3385ae319f68:/# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 15217
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 50000
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) unlimited   # <----------
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) unlimited
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

In my case, if I don't set the --ulimit msgqueue=-1 option, the value is 819200.

Upvotes: 3

i4nk1t
i4nk1t

Reputation: 497

Got to know that --ulimit in docker does not support the value unlimited
The way to do it is

docker run -it --ulimit msgqueue=100000000:100000000

100000000 is for 100GB

Upvotes: 2

Related Questions