1、拉取centos7鏡像
2、啟動鏡像centos7,如果不指定 /bin/bash,容器運行后會自動停止
[root@localhost?~]#?docker?run?-d?-i?-t?<image>?/bin/bash</image>
3、進入容器
[root@localhost?~]#?docker?exec?-it?<container>?bash</container>
4、進入后發現沒有ifconfig,直接yum安裝
[root@8f10fbd6bd5a?/]#?yum?install?-y?net-tools
5、無法ping外網,查找資料重建docker0網絡解決
[root@localhost?~]#?pkill?docker [root@localhost?~]#?iptables?-t?nat?-F [root@localhost?~]#?ifconfig?docker0?down [root@localhost?~]#?brctl?delbr?docker0 [root@localhost?~]#?systemctl?restart?docker [root@localhost?~]#?docker?start?<container></container>
推薦教程:docker教程
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END
喜歡就支持一下吧
相關推薦