一、离线安装
1、软件包下载
https://download.docker.com/linux/static/stable/x86_64/
2、安装docker
tar xvf /opt/docker-24.0.7.tgz -C /usr/local/
cd /usr/local/
cp docker/* /usr/bin/
tee /etc/systemd/system/docker.service <<EOF
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
EOF
chmod +x /etc/systemd/system/docker.service
systemctl daemon-reload
systemctl start docker
systemctl status docker
docker version
二、在线安装
1、安装脚本在线安装
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
2、镜像加速配置
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://b49nkdcy.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
三、参考连接
https://zhuanlan.zhihu.com/p/578402141