0%

docker离线安装

下载安装包

# https://download.docker.com/linux/static/stable/x86_64/
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
# 给文件增加可执行权限
chmod +x /etc/systemd/system/docker.service
systemctl daemon-reload
# 设置开机自启动
systemctl enable docker.service
systemctl start docker
  • 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

配置docker

  • /etc/docker/daemon.json
{
"data-root":"/data/docker",
"log-opts": {
    "max-size": "50m",
    "max-file":"1"
  }
}