How to Fix "bash: ifconfig: command not found" in Ubuntu Docker Containers
It is obvious, usually, we do not check or try to configure network interfaces inside of a Docker container. But there can be rare situations where we need to see the network interfaces and their IP addresses (or even
ping other containers) while we are inside of a container. But the common problem with the official Ubuntu Docker image is, they come with bare minimum packages installed. So, as a result of that, tools like
ping will not be there. But fortunately, we can install almost all the tools we need for our Docker containers, including the
Before doing anything, first, we need to update our local software repository.
Then we need to install the
ifconfig command. You might already try to install it using
apt-get install ifconfig, but it will not work as expected. Because the
ifconfig command comes with a different package called
net-tools. So, let’s install it.
apt install net-tools
The previous command will install the
ifconfig command and you will be able to use it as you usually used to do.
-h flag to see more available options that you can use with the