
1、拉取centos7镜像
[root@localhost ~]# docker pull centos:7
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安装

「在我电脑上明明能跑」——因为少了Docker。帮你写Dockerfile、构建镜像、配置多环境、编排docker-compose,从本地开发到服务器部署一条龙。支持Node.js/Python/Go/Java/前端全栈,覆盖CI/CD集成、安全加固、监控告警,告别环境不一致的噩梦。 触发词:Docker部署、容...
[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教程










