1、ping
1.1首先解决权限问题
docker 中执行:apt-get update
报错:E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)
问题原因:权限不足,请使用 root 用户
解决方案:0 表示 root 用户
docker exec -it id /bin/bash
// 改为
docker exec -u 0 -it id /bin/bash
2.2 ping解决
问题原因:
root@xxxxxxx:/# ping xx.xx.xxx.xxx
bash: ping: command not found
解决方法:
先进入docker
docker exec -u 0 -it docker名或id /bin/bash
更新apt
apt-get update
安装插件ping:
apt install iputils-ping
apt install net-tools
2、ip
问题原因:文章来源:https://www.toymoban.com/news/detail-550454.html
root@xxxxxxx:/# ip a
bash: ip: command not found
解决方法:文章来源地址https://www.toymoban.com/news/detail-550454.html
apt update && apt install -y iproute2
到了这里,关于docker内部ping和ip命令的使用的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!