Reputation: 605
When i run the below command
$ docker container exec -it nginx1 ping nginx2
This is the error which i faced :
OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caused "exec: \"ping\": executable file not found in $PATH": unknown
How to resolve this issue ?
Upvotes: 24
Views: 38071
Reputation: 11
Try to install ping in both conatiners,
apt-get update,
apt-get install inetutils-ping
After that Try the ping command.
Upvotes: 1
Reputation: 53
Install ping utilities in the container .
docker container exec -it webhost /bin/bash
apt-get update
apt-get install inetutils-ping
docker container exec -it webhost ping new_nginx
Upvotes: 3
Reputation: 41
Try this it worked for me
# $ docker container exec -it new_nginx bash
# apt-get update
# apt-get install inetutils-ping
Do it for both the container than run your command
# $ docker container exec -it nginx1 ping nginx2
Upvotes: 3
Reputation: 180
I had the same problem and managed to solve it by accessing:
docker exec -ti <CONTAINER ID> /bin/sh
Upvotes: 5
Reputation: 83
Please use alpine image of nginx:
docker container run -d --name my_nginx_name nginx:alpine
docker container run -d --name my_nginx_name2 nginx:alpine
Then try to ping using below command:
docker container exec -it my_nginx_name ping my_nginx_name2
Upvotes: 8
Reputation: 1141
This something I came across recently. When ran a docker container with a custom name and if we put an command/option(s)/etc after the name, that would be passed to the container as commands. So in here container tried to find the ping command inside it but couldn't, So as the above answer you must install the inetutils-ping
inside the container and run the command
Upvotes: 3
Reputation: 596
Before reading this answer just let you know, it's my 2nd day of learning docker, It may not be the perfect help for you.
This error may also occur when the ping package is not installed in the container, I resolved the problem as follow, bash into the container like this
docker container exec -it my_nginx /bin/bash
then install ping package
apt-get update
apt-get install inetutils-ping
This solved my problem.
Upvotes: 47
Reputation: 757
This error is reported when you try to run the command not found in docker image
. Please check if ping
is installed in the docker
image
.
Upvotes: 0