'Cannot start container: OCI runtime create failed: container_linux.go:349

I am using docker on my CentOS Linux release 7.8.2003 (Core) with 16 GB RAM. My docker version is Docker version 19.03.7. Docker-compose version is docker-compose version 1.23.2. I have 30+ docker containers running on my machine.

Everything was working smoothly, but I ran into a problem. Sometimes, when I try to run a container I get this error

ERROR: for container_name  Cannot start service container_name: OCI runtime create failed: container_linux.go:349: 
starting container process caused "process_linux.go:319: getting the final child's pid from pipe caused \"EOF\"": unknown

When I retry 3-5 times to run container, the container started successfully. Sometimes I need to restart docker service and my server to make it working. I don't know the exact reason why It is giving me this error sometimes and gets created successfully sometimes with same docker-compose file.

Can somebody explain this weird behavior of docker to me? Is it due to so many containers running on my machine or something else?



Solution 1:[1]

Came across this link, which solved the issue for me. It apparently works for WSL, but definitely also for my Ubuntu 18.04 installation: the latest version(s) of docker have this problem, a few versions back they haven't.

Solution 2:[2]

I had a similar issue:

OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:722: waiting for init preliminary setup caused: EOF: unknown

and the problem turned out to be the wrong version of my WSL distro, which was 1 instead of 2:

PS C:\Users\myself> wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Running         1

So I used the wsl --set-version command to upgrade it:

PS C:\Users\myself> wsl --set-version Ubuntu 2
PS C:\Users\myself> wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Running         2

Then I was able to successfully build my Docker image.
Hope can help someone.

Solution 3:[3]

I am a complete newb to Docker and am running Linux 18.04.6 Bionic Beaver docker --version reports Docker version 20.10.7, build 20.10.7-0ubuntu5~18.04.3

I'm not sure if this is the solution, but after reinstalling Docker from various unrelated problems I ran runc init and killed an old running dockerd process and was able to get hello-world to run. I've wasted so much time on it that I don't want to find the root cause.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 alle_meije
Solution 2 Luca Perico
Solution 3 cadaceus2000