1、ping
首先解决权限问题
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
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
问题原因:
root@xxxxxxx:/# ip a
bash: ip: command not found
解决方法:
apt update && apt install -y iproute2
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持代码网。
发表评论