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

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

    If Ubuntu Docker image isn't recognizing 'ifconfig' inside of GNS3, you'll need to open Ubuntu docker image on your host.

    Assuming you already have docker on your host pc and ubuntu pull'd from docker images. Enter these commands in your host OS (Linux, CentOS, etc.) CLI.

    $docker images
    
    $docker run -it ubuntu
    
    $apt-get update
    
    $apt-get install net-tools
    

    (side note: you can add whatever other tools and services that you would like to add now, but for now this is just to get ifconfig to work.)

    $exit
    

    Now you will commit these changes to Docker. This link for committing changes is the best summary and works (skip to Step 4):

    https://phoenixnap.com/kb/how-to-commit-changes-to-docker-image#htoc-step-3-modify-the-container

    When you re-open the docker image in GNS3 you should now have the ifconfig command usable and whatever other tools or services you added to the container.

    Enjoy!

提交回复
热议问题