Categories
Cloud connectivity Containerisation Containers DevOps Docker

How to Ping on a container with No ping utility?

Ever opened a shell or sshed into a container and it does not have the ping binary:

bash: ping: command not found

Install Ping

Use the package manager of the base image

apt update
apt install iputils-ping

Then test:

> ping 1.1.1.1.
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from one.one.one.one (1.1.1.1): icmp_seq=1 ttl=51 time=1.56 ms

phrases:

  • container does not have ping or nc
  • alternative to ping on container

Sources