离线安装Docker
1、下载docker 离线安装包
下载地址如下:Index of linux/static/stable/x86_64/
2、将下载的包上传至服务器上
我这里下载的是20.10.9
3、解压文件
tar -zxvf docker-20.10.9.tgz
解压后的文件如下所示
4、复制文件
cd docker
cp ./* /usr/bin
5、创建docker.service文件
cd /etc/systemd/system/
touch docker.service
6、编辑docker.service 文件
vim docker.service
注意:将其中的ip地址,改成您的服务器地址,其它参数不用改。
--insecure-registry=192.168.205.230
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecure-registry=192.168.205.230
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
修改完成后的docker.service
7、 添加可执行权限
chmod +x docker.service
8、加载docker.service
systemctl daemon-reload
注意,若修改了docker.service文件,则要重新加载该文件。
9、启动docker
systemctl start docker
10、查看docker
systemctl status docker
11、查看docker版本
docker -v
[root@0001 system]# docker -v
Docker version 20.10.9, build c2ea9bc
标签:systemd,infinity,service,离线,Docker,安装,docker
From: https://www.cnblogs.com/HelloWxl/p/17330555.html