Failed to create new OS thread

While trying to start docker-compose i am getting this error:

ERROR: for private_web_1  Cannot start service web: start failed: runtime: failed to create new OS thread (have 8 already; errno=11)
runtime: may need to increase max user processes (ulimit -u)
fatal error: newosproc

my setup is hier: Nginx error: connect() failed (111: Connection refused) while connecting to upstream

any help would be highly appreciated.

When you get error messages that indicate OS related issues, please share more infomration about your OS. Is it Mac, Windows or Linux? Does it have ARM or AMD64 cpu?

Without that I could only search for the title of the topic and found this:

Have you also tried to search for the issue? Could you find anything with the same message that did not seem relevant?

I get this on Linux on Virtual Private Server, it has ‘‘4 Core Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz’’

The problem appears only if I define more then 2-3 Ports in one service.
Like this:

      - 20222:20222
      - 2226:2226
      - 2228:2228
      - 2288:2288
      - 2444:2444

And each time there are differen erros reported.
Like this one:

ERROR: for letsencrypt-companion  Cannot start service letsencrypt-companion: ttrpc: closed: unknown
ERROR: Encountered errors while bringing up the project.

Or that memory limit should be increased.

This is probably because the processes are starting in different order and you have a limit.

Check the content of the following files:

  • /etc/security/limits.conf
  • every file in /etc/security/limits.d/

and search for nproc


Make sure you don’t have limits for the containers: Set ulimits in container

dockerd --default-ulimit