Search code examples
docker-entrypoint

Unable to ping from one container to another container connected in the same network


I created two containers and connected them to a same network. But when I use the commands:

docker exec -ti docker-client1 sh 
ping -c 2 docker-client2 

I get the error:

"sh: 1: ping: not found"

I have used the container names instead of IP address, as both are connected to the same network.


Solution

  • The ping program is not available in your image. Check what OS your image is based on, then research how to install packages on that OS and what package the ping program is contained in.