摘自:https://www.cnblogs.com/adolfmc/p/12124427.html

拉取centos7镜像
[root@localhost ~]# docker pull centos:7
1
启动镜像centos7,如果不指定 /bin/bash,容器运行后会自动停止
[root@localhost ~]# docker run -d -i -t <IMAGE ID> /bin/bash
1
进入容器
[root@localhost ~]# docker exec -it <CONTAINER ID> bash
1
进入后发现没有ifconfig,直接yum安装

[root@8f10fbd6bd5a /]# yum install -y net-tools
1
无法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>

拉取centos7镜像
[root@localhost ~]# docker pull centos:7
1
启动镜像centos7,如果不指定 /bin/bash,容器运行后会自动停止
[root@localhost ~]# docker run -d -i -t <IMAGE ID> /bin/bash
1
进入容器
[root@localhost ~]# docker exec -it <CONTAINER ID> bash
1
进入后发现没有ifconfig,直接yum安装

[root@8f10fbd6bd5a /]# yum install -y net-tools
1
无法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>

相关文章:

  • 2021-07-20
  • 2021-07-30
  • 2021-09-10
  • 2022-02-18
  • 2021-06-15
  • 2021-09-26
  • 2021-09-08
  • 2022-12-23
猜你喜欢
  • 2021-11-18
  • 2021-11-18
  • 2021-11-18
  • 2021-11-18
  • 2021-10-12
相关资源
相似解决方案