Centos7.6安装docker
- 查看centos的版本
- cat /etc/redhat-release
- 更新yum
- yum -y install gcc
- yum -y install gcc-c++
- yum -y install gcc
- 卸载旧版本
-
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
-
- 安装docker软件包
-
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
-
- 安装docker仓库源(阿里云)
-
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
-
- 更新yum索引
- yum makecache fast
- 安装dockerCE
- yum install docker-ce docker-ce-cli containerd.io
- 启动docker
- systemctl start docker
- 设置开机自启
- systemctl enable docker
- 测试docker
- docker version
- docker run hello-world
- 配置docker镜像加速卸载docker
-
登录阿里云
https://dev.aliyun.com -
安装镜像
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://m3unpse0.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
-
- 卸载docker
-
systemctl stop docker
-
yum remove docker-ce
-
rm -rf /var/lib/docker