docker tutorials

Docker: Error response from daemon: OCI runtime create failed: container_linux.go:349

This tutorial guides you on how to resolve the following issue Docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused “exec: \”ping\”: executable file not found in $PATH”: unknown.

Docker: Error response from daemon: OCI runtime create failed

While running the following docker run command it failed with below error response. From the response it is clear that OCI runtime create failed i.e., unable to start the container process because it cannot find “ping” in the container.

[email protected]:~ (sneppets-gcp)$ docker run --rm ubuntu ping google.com
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
692c352adcf2: Pull complete
97058a342707: Pull complete
2821b8e766f4: Pull complete
4e643cc37772: Pull complete
Digest: sha256:55cd38b70425947db71112eb5dddfa3aa3e3ce307754a3df2269069d2278ce47
Status: Downloaded newer image for ubuntu:latest
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"ping\": executable file not found in $PATH": unknown.
ERRO[0010] error waiting for container: context canceled

In order to resolve the above issue, you need to install ping utility using apt-get with the help of interactive commands. To install ping utility you need to get to bash of our container. For example, if you wanted to run bash in our container we need to use the following options in the docker run command as shown below.

$ docker run --rm -i -t ubuntu bash

[email protected]:/# echo hello world
hello world

Interactive Commands

-i -> interactive
-t -> to emulate the text terminal

$ docker run –rm -i -t

The above  command operates more likely in a new terminal

Then you can install ping from bash using the following apt-get commands. First, run apt-get update command.

[email protected]:/# apt-get update
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [1077 B]
Get:4 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [44.5 kB]
Get:5 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [164 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates InRelease [111 kB]        
Get:7 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [33.9 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:10 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [157 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [33.9 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [310 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [4224 B]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [3209 B]
Fetched 14.2 MB in 5s (2774 kB/s)
Reading package lists... Done

Afterwards, run the following apt-get install command

[email protected]:/# apt-get install iputils-ping

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libcap2 libcap2-bin libpam-cap
The following NEW packages will be installed:
  iputils-ping libcap2 libcap2-bin libpam-cap
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 90.5 kB of archives.
After this operation, 333 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libcap2 amd64 1:2.32-1 [15.9 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 libcap2-bin amd64 1:2.32-1 [26.2 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 iputils-ping amd64 3:20190709-3 [40.1 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal/main amd64 libpam-cap amd64 1:2.32-1 [8352 B]
Fetched 90.5 kB in 1s (76.2 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libcap2:amd64.
(Reading database ... 4122 files and directories currently installed.)
----
----
----
Setting up iputils-ping (3:20190709-3) ...
Processing triggers for libc-bin (2.31-0ubuntu9) ...

Finally, ping google.com. Now you should be able to ping.

[email protected]:/# ping google.com
PING google.com (74.125.24.139) 56(84) bytes of data.
64 bytes from 74.125.24.139 (74.125.24.139): icmp_seq=1 ttl=113 time=1.22 ms
64 bytes from 74.125.24.139 (74.125.24.139): icmp_seq=2 ttl=113 time=1.27 ms
64 bytes from 74.125.24.139 (74.125.24.139): icmp_seq=3 ttl=113 time=1.32 ms
64 bytes from 74.125.24.139 (74.125.24.139): icmp_seq=4 ttl=113 time=1.09 ms
^C
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 1.089/1.224/1.324/0.087 ms

You can also do require changes in the container and can commit back the changes (ping utility installation) that is done to the file system back to the docker image.

Hope it helped 🙂

Also See:

References:

Leave a Reply

avatar
  Subscribe  
Notify of