Friday, 26 June 2020

OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"ping\": executable file not found in $PATH": unknown

root@sankar:~# docker container exec -it my_nginx ping new_nginx
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"ping\": executable file not found in $PATH": unknown
root@sankar:~#



Step1:- Inspect the networks

root@sankar:~# docker network inspect my_app_network
...
...
Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "8552c9a1a0b2ba2868e50e23da0041af55a4289d34c0ba52aa513e7f27b7288b": {
                "Name": "new_nginx",
                "EndpointID": "0a2e1f480d6e83775b883a1fe2f957b6fb12cf30f3815e5f77455972e08f2752",
                "MacAddress": "02:42:ac:12:00:03",
                "IPv4Address": "172.18.0.3/16",

                "IPv6Address": ""
            },
            "bf91af54c120c162993e53574143d2e8c0d783b53e8b6e0c539f04d5a54c78e3": {
                "Name": "my_nginx",
                "EndpointID": "54c248889596acb6055106f1ce7edec2513608062e10309094b1fcb4f3fbcb4e",
                "MacAddress": "02:42:ac:12:00:02",
                "IPv4Address": "172.18.0.2/16",

                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]


                                                                                                                                                    
Step3:- Install the ping on both the containers.


root@sankar:~# docker container exec -it my_nginx  bash 
root@bf91af54c120:/#
 
root@bf91af54c120:/# apt update
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [121 kB]        
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [204 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7905 kB]
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [7868 B]                                                                        
Fetched 8355 kB in 14s (596 kB/s)                                                                                                                     
Reading package lists... Done
Building dependency tree      
Reading state information... Done
All packages are up to date.


root@bf91af54c120:/# 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 104 kB of archives.
After this operation, 319 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://deb.debian.org/debian buster/main amd64 libcap2 amd64 1:2.25-2 [17.6 kB]
Get:2 http://deb.debian.org/debian buster/main amd64 iputils-ping amd64 3:20180629-2+deb10u1 [43.3 kB]
Get:3 http://deb.debian.org/debian buster/main amd64 libcap2-bin amd64 1:2.25-2 [28.8 kB]
Get:4 http://deb.debian.org/debian buster/main amd64 libpam-cap amd64 1:2.25-2 [14.3 kB]
Fetched 104 kB in 1s (166 kB/s)     
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libcap2:amd64.
(Reading database ... 7632 files and directories currently installed.)
Preparing to unpack .../libcap2_1%3a2.25-2_amd64.deb ...
Unpacking libcap2:amd64 (1:2.25-2) ...
Selecting previously unselected package iputils-ping.
Preparing to unpack .../iputils-ping_3%3a20180629-2+deb10u1_amd64.deb ...
Unpacking iputils-ping (3:20180629-2+deb10u1) ...
Selecting previously unselected package libcap2-bin.
Preparing to unpack .../libcap2-bin_1%3a2.25-2_amd64.deb ...
Unpacking libcap2-bin (1:2.25-2) ...
Selecting previously unselected package libpam-cap:amd64.
Preparing to unpack .../libpam-cap_1%3a2.25-2_amd64.deb ...
Unpacking libpam-cap:amd64 (1:2.25-2) ...
Setting up libcap2:amd64 (1:2.25-2) ...
Setting up libcap2-bin (1:2.25-2) ...
Setting up libpam-cap:amd64 (1:2.25-2) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up iputils-ping (3:20180629-2+deb10u1) ...
Processing triggers for libc-bin (2.28-10) ...
root@bf91af54c120:/#


Step4:- Final check
root@sankar:~# docker container exec -it my_nginx ping new_nginx
PING new_nginx (172.18.0.3) 56(84) bytes of data.
64 bytes from new_nginx.my_app_net (172.18.0.3): icmp_seq=1 ttl=64 time=0.277 ms
64 bytes from new_nginx.my_app_net (172.18.0.3): icmp_seq=2 ttl=64 time=0.122 ms
64 bytes from new_nginx.my_app_net (172.18.0.3): icmp_seq=3 ttl=64 time=0.123 ms
64 bytes from new_nginx.my_app_net (172.18.0.3): icmp_seq=4 ttl=64 time=0.107 ms
^C
--- new_nginx ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 32ms
rtt min/avg/max/mdev = 0.107/0.157/0.277/0.069 ms
root@osboxes:~#

No comments:

Post a Comment