Home >Operation and Maintenance >Docker >How docker install centos image
1. Pull the centos7 image
[root@localhost ~]# docker pull centos:7
2. Start the centos7 image. If /bin/bash is not specified, the container will automatically stop after running
[root@localhost ~]# docker run -d -i -t <IMAGE ID> /bin/bash
3. Enter the container
[root@localhost ~]# docker exec -it <CONTAINER ID> bash
4. After entering, you find that there is no ifconfig, install it directly with yum
[root@8f10fbd6bd5a /]# yum install -y net-tools
5 , Unable to ping the external network, find the information and rebuild the docker0 network to solve the problem
[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>
Recommended tutorial: docker tutorial
The above is the detailed content of How docker install centos image. For more information, please follow other related articles on the PHP Chinese website!