Docker最新版本离线安装

1.RPM安装方式

前提:拥有一台连接网络的Linux主机

1.更新yum:yum update

2.下载docker yum源:yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

3.按版本降序列出docker: yum list docker-ce --showduplicates | sort -r

 

 4.下载最新版本Docker所需依赖包: yum install --downloaddir=/root/tmp/ --downloadonly docker-ce:20.10.6

 

5.进入/root/tmp下安装所有依赖包: rpm -Uvh *.rpm

6.查看docker版本 docker -v

tgz方式安装

1.下载最新的tgz包:https://download.docker.com/linux/static/stable/x86_64/

  

 

 

 2.上传到服务器并解压:tar -zxvf XXX.tgz

3.将解压文件复制到 /usr/bin/ 目录:cp docker/* /usr/bin/

4.进入目录:cd /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
# 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
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

 

5.docker.service添加执行权限:chmod +x docker.service

6.重新加载配置文件:docker.service(每次修改docker.service都需要重新加载)

7.启动:systemctl start docker

8.查看:systemctl status docker

 

posted on 2020-05-27 00:04  小小阳阳1994  阅读(696)  评论(0编辑  收藏  举报

导航