运维系列(亲测有效):Docker的ubuntu镜像安装的容器无ifconfig和ping命令的解决




Docker的ubuntu镜像安装的容器无ifconfig和ping命令的解决

亲测可以解决但是再次运行ubuntu就不行了还需要重装,还未解决:

实际上不用重装了(可能和教程的情况不太一样)

博主最近真的是天天踩坑:

[root@foundation38 tidb]# docker run -it --name vm1 ubuntu
root@6ac61d6d507e:/# ping vm1   ubuntu镜像没有ping和ip命令
bash: ping: command not found
root@6ac61d6d507e:/# ip addr 
bash: ip: command not found
root@6ac61d6d507e:/# exit
exit

在这里插入图片描述

[root@foundation38 tidb]# docker run -it --name vm2 ubuntu
root@a77e06da9b86:/# apt-get update
root@a77e06da9b86:/# apt install net-tools   安装ifconfig
root@a77e06da9b86:/# apt install iputils-ping  安装ping

测试:

root@a77e06da9b86:/# 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 19573  bytes 27511619 (27.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 19440  bytes 1738567 (1.7 MB)
        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 0  (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
root@a77e06da9b86:/# ping vm2
PING vm2.ilt.example.com (220.250.64.20) 56(84) bytes of data.
^C
--- vm2.ilt.example.com ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 1999ms

在这里插入图片描述







IT运维小白

Docker的ubuntu镜像安装的容器无ifconfig和ping命令的解决

  • 21
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

坦笑&&life

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值