第1步:下载docker离线安装包
下载地址:https://download.docker.com/linux/static/stable/
第2步:解压与复制
shell
tar -xvf docker-28.4.0.tgz
sudo cp docker/* /usr/bin/
第3步:创建systemd服务文件
shell
vim /etc/systemd/system/docker.service
编辑内容
shell
[Unit]
Description=Docker Application Container Engine
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/bin/dockerd
Restart=on-failure
LimitNOFILE=infinity
[Install]
WantedBy=multi-user.target
第4步:启动并设置开机自启
shell
sudo systemctl daemon-reload
sudo systemctl start docker
sudo systemctl enable docker
第5步:查看docker版本
shell
docker -v