1、拉取centos7鏡像
2、啟動(dòng)鏡像centos7,如果不指定 /bin/bash,容器運(yùn)行后會(huì)自動(dòng)停止
[root@localhost?~]#?docker?run?-d?-i?-t?<image>?/bin/bash</image>
3、進(jìn)入容器
[root@localhost?~]#?docker?exec?-it?<container>?bash</container>
4、進(jìn)入后發(fā)現(xiàn)沒(méi)有ifconfig,直接yum安裝
[root@8f10fbd6bd5a?/]#?yum?install?-y?net-tools
5、無(wú)法ping外網(wǎng),查找資料重建docker0網(wǎng)絡(luò)解決
[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教程
? 版權(quán)聲明
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載。
THE END
喜歡就支持一下吧
相關(guān)推薦