Getting can't start new thread Error for building docker image

AT time of installing any PIP package I am getting this error.
I have tried updating the docker version also but no luck.
For Docker version 20.10.21, build baeda1f
VM Ubuntu 18.04.6 LTS (GNU/Linux 5.4.0-1109-azure x86_64)
When I am trying to build the docker file getting this error

File “/usr/local/lib/python3.9/”, line 899, in start
** _start_new_thread(self._bootstrap, ())**
RuntimeError: can’t start new thread

here is content of docker file

FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9
RUN pip install aiohttp==3.6.2

1 Like

Hi, got the same problem, were you able to fix it?

See my answer here: RuntimeError: can't start new thread - #2 by asofyan