安装
- 先安装 gcc
sudo yum -y install gcc
- 如果有安装过 docker ,需要执行以下命令移除安装
sudo yum remove docker
docker-client
docker-client-latest
docker-common
docker-latest
docker-latest-logrotate
docker-logrotate
docker-selinux
docker-engine-selinux
docker-engine - 添加镜像仓库(这里使用的是阿里的镜像仓库)
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
- 更新 yum 软件包索引
sudo yum makecache fast
- 安装 docker-ce
sudo yum -y install docker-ce
- 启动docker
systemctl start docker
- 配置镜像加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-‘EOF‘
{
"registry-mirrors": ["https://xxxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker - docker hello-world
docker run hello-world
原文地址:https://www.cnblogs.com/Godfunc/p/9724239.html
时间: 2024-10-10 16:53:29