Use docker to install centos6 system

System environment description

System: deepin15.11
Platform:x86_64

Install docker

sudo apt install docker
sudo apt install docker-ce-cli
sudo apt install docker-ce

Download centos6 mirror

Find centos6 mirror

centos	 镜像库地址:https://hub.docker.com/_/centos

Download centos6 mirror

Modify the mirror source
docker uses a foreign mirror by default, and you need to modify it to use a domestic mirror.
Edit the daemon.json file. If there is no daemon.json file, create the file

# 先启动docker,使其生成/etc/docker文件夹
sudo systemctl start docker.service
#
sudo vim /etc/docker/daemon.json

Add the following content in the daemon.json file

{
  "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn","https://registry.docker-cn.com","http://hub-mirror.c.163.com"]
}

Then restart docker to make the daemon.json file take effect

sudo systemctl restart docker.service

Download mirror

sudo docker pull centos:centos6.10

Run centos6 container

sudo docker run -it --name centos6 centos:centos6.10
# 退出容器后,重新启动容器
sudo docker centos6

Other available parameters:,
-p 宿主机端口:容器端口such -p 8080:80
-v 宿主机路径:容器路径as-v /my/own/datadir:/usr/local

Enter centos6 system

docker exec -it 容器名称 bash
# 如以下命令
docker exec -it centos6 bash

Guess you like

Origin blog.csdn.net/macaiyun0629/article/details/107090943
Recommended