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

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

    Please use the below command to get the IP address of the running container.

    $ ip addr
    

    Example-:

    root@4c712d05922b:/# ip addr
    1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host
           valid_lft forever preferred_lft forever
    247: eth0@if248:  mtu 1500 qdisc noqueue state UP group default
        link/ether 02:42:ac:11:00:06 brd ff:ff:ff:ff:ff:ff link-netnsid 0
        inet 172.17.0.6/16 scope global eth0
           valid_lft forever preferred_lft forever
        inet6 fe80::42:acff:fe11:6/64 scope link
           valid_lft forever preferred_lft forever
    

提交回复
热议问题