Home  >  Article  >  Operation and Maintenance  >  How docker install centos image

How docker install centos image

王林
王林Original
2020-04-14 15:06:012618browse

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

How docker install centos image

[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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn