I want to set core file size to unlimited in a Docker container.
I tried changing limits.conf
in container.
RUN sed -i.bak '/\# End of file/ i\\* soft core unlimited' /etc/security/limits.conf
RUN sed -i.bak '/\# End of file/ i\\* hard core unlimited' /etc/security/limits.conf
I restarted the container but that didn't work.
Core file size is always 0.
I can use the command
$ ulimit -c unlimited
for setting core file size. But I have to use the command for another application. So I don't want us these commands.
Please let me know how I can change the core file size in a Docker container.
You can set the limits on the container on docker run
with the --ulimit
flag.
docker run --ulimit core=<size> ...
Note that "unlimited" is not a supported value since it is not actually a real value, but -1
is equivalent to it:
$ docker run -it --ulimit core=-1 ubuntu:18.04 sh -c 'ulimit -a | grep core'
coredump(blocks) unlimited
~ $