Ulimit: open files: cannot modify limit: Operation not permitted

Expected behavior

This works on my docker in virtualbox on mac and against a docker on debian:

$ docker run centos bash -c ‘ulimit -n 10000 && echo SUCCESS’
SUCCESS

(not sure if it really had an effect, but a service I run calls ulimit and fails to start if ulimit fails)

Actual behavior

With the Docker for Mac beta this fails.

$ docker run centos bash -c ‘ulimit -n 10000 && echo SUCCESS’
bash: line 0: ulimit: open files: cannot modify limit: Operation not permitted

Information

OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.10.3-beta5

Steps to reproduce the behavior

  1. docker run centos bash -c ‘ulimit -n 10000 && echo SUCCESS’

If the default ulimit is different, it would be good to document it. Maybe I just need to increase the ulimit in the Docker for Mac “Alpine Linux” vm running in the hypervisor? I found this file and hoped adding fs.file-max = 100000 to it would override, but pinata restart clears it.
~/Library/Containers/com.docker.docker/Data/database/com.docker.driver.amd64-linux/etc/sysctl.conf

docker run --ulimit nofile=10000:10000 centos bash -c 'ulimit -n 10000 && echo SUCCESS' works correctly for me but, as you say, docker run centos bash -c 'ulimit -n 10000 && echo SUCCESS' fails.

I will open an issue to investigate alignment of the default ulimits across the different docker products – Docker for Mac may have a lower nofile ulimit than it should.

Thanks for your report and participation in the Docker for Mac Beta!

1 Like

This will be fixed in the next beta (Tuesday 5 April), the ulimits have been changed to match boot2docker.

1 Like