I've just installed ubuntu docker image, when I execute "ifconfig" it says there's no such command, I tried apt-get install by there's no package named "ifconfig"(I can install some other images).
So how to do this? Thanks.
On a fresh ubuntu docker image, run
apt-get update
apt-get install net-tools
These can be executed by logging into the docker container or add this to your dockerfile to build an image with the same.
You could also consider:
RUN apt-get update && apt-get install -y iputils-ping
(as Contango comments: you must first run apt-get update, to avoid error with missing repository).
See "Replacing ifconfig with ip"
it is most often recommended to move forward with the command that has replaced
ifconfig. That command isip, and it does a great job of stepping in for the out-of-dateifconfig.
But as seen in "Getting a Docker container's IP address from the host", using docker inspect can be more useful depending on your use case.
write
sudo apt-get install net-tools