離線安裝Docker
1避矢、下載docker 離線安裝包
2悼瘾、將下載的包上傳至服務(wù)器上
我這里下載的是20.10.9
3、解壓文件
tar -zxvf docker-20.10.9.tgz
解壓后的文件如下所示
4审胸、復(fù)制文件
cd docker
cp ./* /usr/bin
5亥宿、創(chuàng)建docker.service文件
cd /etc/systemd/system/
touch docker.service
6、編輯docker.service 文件
vim docker.service
注意:將其中的ip地址砂沛,改成您的服務(wù)器地址烫扼,其它參數(shù)不用改。
--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碍庵、 添加可執(zhí)行權(quán)限
chmod +x docker.service
8映企、加載docker.service
systemctl daemon-reload
注意,若修改了docker.service文件静浴,則要重新加載該文件堰氓。
9、啟動(dòng)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