docker离线安装
步骤一: 官网下载 Docker 安装包
wget https://download.docker.com/linux/static/stable/x86_64/docker-24.0.6.tgz
步骤二: 解压安装包
tar -zxvf docker-24.0.6.tgz
步骤三: 将解压后的 Docker 文件移到 /usr/bin 目录下
sudo cp docker/* /usr/bin/
步骤四: 将 Docker 注册为系统服务
vim /etc/systemd/system/docker.service
然后在文件中添加以下内容,退出并保存。
[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
步骤五: 给文件增加可执行权限
chmod +x /etc/systemd/system/docker.service
systemctl daemon-reload
步骤六: 设置开机自启动
systemctl enable docker.service
步骤七: 启动 Docker
systemctl start docker
步骤八: 测试 Docker 是否启动
docker run hello-world