DevOps | Cloud | Analytics | Open Source | Programming





How To Fix - "Error Response from Daemon: OCI Runtime Create Failed" in Docker ?



In this post, we will explore How To Fix - "Error Response from Daemon: OCI Runtime Create Failed" in Docker. Sample Error :


docker: Error response from daemon: OCI runtime create failed: container\_linux.go:253: starting container process caused "process\_linux.go:204: copying bootstrap data to pipe caused \\"write init-p: broken pipe\\"": unknown.


Unexpected environment preparation error: Error response from daemon: 
OCI runtime create failed: container\_linux.go:123: 
starting container process caused "process\_linux.go:125: 
getting the final child's pid from pipe caused \\"EOF\\"": unknown


docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'
nvidia-container-cli: initialization error: driver rpc error: failed to process request: unknown.


docker: Error response from daemon: failed to create shim: OCI runtime create failed: container\_linux.go:47: starting container process caused: process\_linux.go:512: waiting for init preliminary setup caused: EOF: unknown.
ERRO\[0007\] error waiting for container: context canceled


Error response from daemon: failed to create shim: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error setting cgroup config for procHooks process: unable to find device '99/136': scan /proc/devices line "33": EOF: unknown Error: failed to start containers: a4ba5a6a6ab4


docker: Error response from daemon: OCI runtime create failed: invalid mount

 

Primitive Checks :

Do the below basic Primitive checks to understand the cause of the issue.

  • Are the "correct" commands being passed to containers in the process or job ?
  • Is the executable file correct defined in $PATH with the right set of permissions to access ?
  • Is there a possibility that the host runc binary is being overwritten (by some unknown process or user). Such possibility might rise if there are chances to execute a command as root within the container.
  • Is there any bind mount that is wrongly used ?
  • Are the ENTRYPOINT and CMD directives correctly used ?
 

Solution :

  • Sometimes the solution could be as basic as using or updating the right Docker version. You would be surprised how many times using the version update has fixed this issue.
May be uninstall the old version and use the latest version of Docker. And MAKE SURE to install Docker from the official repo. Docker distro from anywhere else(e.g. docker that comes pre-installed\bundled) might not cope with everything else in the Docker world. To do that follow the below steps - Uninstall older Docker


sudo apt-get remove docker docker-engine docker.io containerd runc

Update the apt package index:


sudo apt-get update

Grant read permission for the Docker public key file before updating the package index


sudo chmod a+r /etc/apt/keyrings/docker.gpg
sudo apt-get update

Install the latest version


sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

Verify that the Docker Engine installation


sudo docker run hello-world

   

  • Try changing  the bind mount to a different dir if applicable or possible for your case.
Bind mounts have limited functionality compared to volumes. When you use a bind mount, a file\directory from the host machine is mounted into a container. The file\directory is referenced by its absolute path on the host machine. However when you use a volume, a new dir is created within Docker’s storage directory on the host machine, and Docker manages that directory’s contents. The file or directory does not need to exist on the Docker host already. It is created on demand if it does not yet exist. Bind mounts rely on the host machine’s filesystem having a specific directory structure available. For new Docker applications, better to use named volumes instead. You can’t use Docker CLI commands to directly manage bind mounts. Note the below pointers with regards to bind mount.

    • /bin - contains executable files - that are part of the core operating system. Such files has to be accessible before /usr gets mounted. (e.g. the mount command is in /bin/mount).
    • /usr/bin - contains executable files - that are not part of the core operating system. These are considered to be "system wide binaries".
    • /tmp - for temporary data. Usually cleared at few days or cleared on each reboot too.
    • /var/tmp - Usually for more persistent data (still a "throw away" though). Also cleared periodically. But might not be cleaned out on reboot.
   

  • If the error is due to the entrypoint.sh file, use the below for the entrypoint.sh file
Also note that entrypoint.sh often has problem with windows line endings. The git repo might have a script with unix line endings (\n). But while checked-out on windows, git might replace the line endings with windows line endings (\r\n). So the "shebang" mightn't work - because instead of looking for /bin/bash, it will look for /bin/bash\r. So do not let git to do automatic conversion -


git config --global core.autocrlf input

  Make sure the entrypoint.sh file is not saved with Windows line endings (CRLF). If it is, save it with Unix line endings (LF) . Then run the below -


##Linux 

$ chmod +x entrypoint.sh
$ git add entrypoint.sh
$ git commit

 


##Windows

$ git add --chmod=+x -- entrypoint.sh
$ git commit

   

  • Try to Restart the docker service.

\# service docker restart

OR


sudo systemctl restart docker

OR


sudo systemctl stop docker

sudo systemctl start docker

  Hope these help to fix the issue.    

Other Reads -

 


docker: Error response from daemon,Error response from daemon: OCI runtime create failed ,Unexpected environment preparation error: Error response from daemon: ,OCI runtime create failed: container\_linux.go: ,docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed ,Error response from daemon: failed to create shim ,failed to create shim: OCI runtime create failed ,Error response from daemon: OCI runtime create failed: invalid mount ,docker hub ,docker compose ,oci runtime create failed windows ,oci runtime create failed kubernetes ,oci runtime create failed permission denied ,docker slim oci runtime create failed ,oci runtime create failed: container\_linux.go:380: starting container process caused ,oci runtime create failed: runc create failed: unable to start container process ,oci runtime create failed: container with id exists: ,oci runtime create failed container\_linux.go permission denied unknown ,oci runtime create failed: container\_linux.go:380 permission denied ,docker volume permission denied ,docker exec permission denied ,oci runtime exec failed permission denied ,docker entrypoint permission denied ,exec wait for it sh permission denied unknown ,docker tmp permission denied ,