Generally people pull the official image of Ubuntu/CentOS but they don't realize that these images are minimal and doesn't have any thing on the top of that.
For Ubuntu, this image is built from official rootfs tarballs provided by Canonical. Given that it is a minimal install of Ubuntu, this image only includes the C, C.UTF-8, and POSIX locales by default.
One can install net-tools (includes ifconfig, netstat), ip-utils(includes ping) andy other likes curl etc on container and can create image from container or can write Dockerfile that will install these tool while creating image.
Below is Dockerfile example, while creating image from this it will include these tools:
FROM vkitpro/ubuntu16.04
RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install iputils-ping -y \
&& apt-get install net-tools -y \
CMD bash
or launch container from base image and install these utilities on container and then commit to image.
docker commit -m "any descriptive message" container_id image_name:lattest
That image will have all thing installed.
ping
specifically (e.g. to measure latency precisely), usewget
instead (which is provided via/usr/bin/wget
in stock Ubuntu images routinely).time wget
is not that precise, but if you're in a rootless docker, it's IMVHO the simplest and fastest way to check connectivity, DNS resolution and rough speeds. β Bacchus