docker安装centos7镜像

xiaoxiao2021-07-06  355

拉取centos7镜像 [root@localhost ~]# docker pull centos:7 启动镜像centos7,如果不指定 /bin/bash,容器运行后会自动停止 [root@localhost ~]# docker run -d -i -t <IMAGE ID> /bin/bash 进入容器 [root@localhost ~]# docker exec -it <CONTAINER ID> bash 进入后发现没有ifconfig,直接yum安装 [root@8f10fbd6bd5a /]# yum install -y net-tools 无法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 ID>
转载请注明原文地址: https://www.6miu.com/read-4821491.html

最新回复(0)