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 ?
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With