009_Docker運(yùn)行ubuntu容器無ifconfig和ping等命令

Doker提供的ubuntu鏡像非常干凈,大小只有63.1MB,沒有常見的一些基本庫。

image.png

進(jìn)入ubuntu容器中查找不到ifconfig,ping,vim等基本命令。

test01@test:~$ docker run -it --name version1 ubuntu:18.04 /bin/bash

root@e63d89aab255:/# ifconfig

bash: ifconfig: command not found

root@e63d89aab255:/# ping www.baidu.com

bash: ping: command not found

root@e63d89aab255:/# ^C

root@e63d89aab255:/# vim

bash: vim: command not found

root@e63d89aab255:/#

image.png

通過apt-get命令進(jìn)行安裝。

root@e63d89aab255:/# apt-get update

root@e63d89aab255:/# apt install net-tools 安裝ifconfig

root@e63d89aab255:/# apt install iputils-ping 安裝ping

image.png
image.png
image.png

【注】:

net-tools包含:arp, ifconfig, netstat, rarp , nameif, route這幾個(gè)工具。

測試是否成功

root@e63d89aab255:/# ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

    inet 172.17.0.2  netmask 255.255.0.0  broadcast 172.17.255.255

    ether 02:42:ac:11:00:02  txqueuelen 0  (Ethernet)

    RX packets 12363  bytes 25090342 (25.0 MB)

    RX errors 0  dropped 0  overruns 0  frame 0

    TX packets 8626  bytes 473222 (473.2 KB)

    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

    inet 127.0.0.1  netmask 255.0.0.0

    loop  txqueuelen 1000  (Local Loopback)

    RX packets 0  bytes 0 (0.0 B)

    RX errors 0  dropped 0  overruns 0  frame 0

    TX packets 0  bytes 0 (0.0 B)

    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
image.png

原文鏈接:
Docker運(yùn)行ubuntu容器無ifconfig和ping等命令 - 知乎 (zhihu.com)
Docker運(yùn)行ubuntu容器無ifconfig和ping等命令 (qq.com)

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容