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.
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.
sudo apt-get install iproute2 then run ip addr show
it works..
On a fresh ubuntu docker image, run
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:
(as Contango comments: you must first run
apt-get update
, to avoid error with missing repository).See "Replacing ifconfig with ip"
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.From within a Dockerfile something like the following should do the trick:
From memory it's best practice to combine the update and the package installation lines to prevent docker caching the update step which can result in out-dated packages being installed.
Installing it via the CLI or a shell script:
apt-get update && apt-get install net-tools
In case you want to use the Docker image as a "regular" Ubuntu installation, you can also run
unminimize
. This will install a lot more thanifconfig
, so this might not be what you want.write
sudo apt-get install net-tools