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

前端 未结 9 1350
后悔当初
后悔当初 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:38

    From within a Dockerfile something like the following should do the trick:

    RUN apt-get update && \
         apt-get install -y net-tools
    

    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

提交回复
热议问题