CentOS7安装Docker容器
1、查看Linux环境是否是CentOS7
cat /etc/redhat-release
2、yum安装gcc
yum -y install gcc
yum -y install gcc-c++
3、安装需要的软件包
yum install -y yum-utils device-mapper-persistent-data lvm2
4、设置stable镜像仓库
官网(容易超时):yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
推荐(国内仓库):yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
5、更新yum软件包索引
yum makecache fast
6、安装DOCER CE
yum -y install docker-ce
7、启动docker
systemctl start docker
8、测试
docker version
docker run hello-world
9、配置阿里云镜像加速器:速度快
https://dev.aliyun.com/search.html
阿里云开发者平台查看自己的加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["自己的加速器地址"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
#启动helloWorld
docker run hello-world