Docker daemon dies with error 'Thread.create: Resource temporarily unavailable'

After utilizing the docker run command frequently the docker daemons dies with the following error:

docker: Error response from daemon: Mounts denied: 9p: Sys_error(“Thread.create: Resource temporarily unavailable”).

This message is fixed by restarting docker.

The operation that is causing the issue is:

docker run
–net=host
-i
-v $HOME/.m2:/root/.m2
-v $HOME/.aws:/root/.aws
-v “$(pwd)”:/opt/deploy
$DOCKER_ARGS
$DOCKER_DEPLOY_TAG “${COMMANDS[@]}”

This operation is called many times because we rely on it to run specific commands inside a container to ensure same outputs across different environments and also to use tools that have been installed inside the container.

We’ve experiments with adding --pids-limit=-1, --restart=on-failure:2, and --ulimit nofile=1048576:1048576 as args in the docker run command, but these have not helped as we still receive this error message.

Any idea what is happening? Is this a system issue for docker for mac?

Thanks for the report. I can confirm that there is a thread leak and investigation has begun.

This should be fixed in the just released Beta 25. Thanks for your report!