【Docker】离线部署

离线安装Docker

1、下载docker 离线安装包

下载地址

2、将下载的包上传至服务器上

我这里下载的是20.10.9

image-20230418164826277.png

3、解压文件

tar -zxvf docker-20.10.9.tgz

解压后的文件如下所示

image-20230418165346059.png

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

image-20230418173251117.png

7、 添加可执行权限

chmod +x docker.service

8、加载docker.service

systemctl daemon-reload

注意,若修改了docker.service文件,则要重新加载该文件。

9、启动docker

systemctl start docker

10、查看docker

systemctl status docker
image-20230418173251117.png

11、查看docker版本

docker -v
[root@0001 system]# docker -v
Docker version 20.10.9, build c2ea9bc

你可能感兴趣的:(【Docker】离线部署)