How to install “ifconfig” command in my ubuntu docker image?

前端 未结 9 1238
后悔当初
后悔当初 2021-01-30 02:50

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 i

9条回答
  •  伪装坚强ぢ
    2021-01-30 03:32

    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 is ip, and it does a great job of stepping in for the out-of-date ifconfig.

    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.

提交回复
热议问题