Why isn't ifconfig available in Ubuntu Docker container?

With the base ubuntu:12.04, ifconfig is not available in the container, though the ip command is available, why is this? and, how to get ifconfig in the container?


Solution 1:

You can install ifconfig with apt-get install net-tools. (Specifically, by adding RUN apt-get install -y net-tools to your Dockerfile.)

Based on my test, ifconfig is included in ubuntu:14.04.

Solution 2:

Unless and until you can install net-tools, there is no need to give it by default. Also if you want to see the IP address then there is another command available by docker itself:-

docker inspect <container_name or container_id>

docker inspect syntax: docker inspect [OPTIONS] NAME|ID [NAME|ID...]

This cmd will show you every detail of running container including IP address.