如果想安装指定版本的docker,后面跟上版本号,格式如下:
yum -y install docker-ce-24.0.6
安装成功如下图所示:

关闭系统防火墙。如果是生产环境开放指定端口
Docker应用需要用到各种端口,逐一去修改防火墙设置。非常麻烦,因此建议大家直接关闭防火墙,但是公司生产环境不能这样做。
systemctl stop firewalld
systemctl disable firewalld
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
启动 Docker 并设置开机自启
systemctl start docker
systemctl enable docker
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
查看docker版本,验证是否安装成功
docker version
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">

3 配置镜像加速
docker官方镜像仓库网速较差,有的甚至访问不了,我们需要设置国内镜像服务。但现在绝大多数正规的镜像网站停用了。
亲测可用的仓库:https://hub.atomgit.com/repos
设置仓库:
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://hub.atomgit.com/repos"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
上面命令配置中:“registry-mirrors”: [“https://hub.atomgit.com/repos”],后面的地址可以替换成认可可用的镜像仓库地址。
之前阿里云镜像仓库文档:https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors。但现在不一定能用。
其他剩余可用仓库可在这自己尝试:https://linux.do/t/topic/114516
>>
评论记录:
回复评论: