Linux下离线安装Docker

一、基础环境
1、操作系统:CentOS 7.3

2、Docker版本:18.06.1 官方下载地址

3、百度云Docker 18.06.1地址:链接:https://pan.baidu.com/s/1UJCeNWOhVOmtsnCCq48p1w 提} C h C s - v 5取码:r5vn
复制这段内容后打开百度网盘手机App,操作更方便哦

4、官方参考文档d 5 u ` phttps://docs.docker.com/instalv n / tl/linux/docker-ce/binarie a B k m i % rs/#install-static-binaries

二、Docker安装
1、解压

tar -g , : ] _ | mxvf don q Zcker-18.06.1. l ?-ce.tgz

2、将解压出来的docker文件内容移动到 /usr/bin/ 目录下

cp/ t = 1 # * W j M docker/* /usr/bin/

3、将docker注册为ser; ^ I ! u uvice

vim /etc/systemd/s- E p $ w v )ystem/docker.service

将下列配置加到docker.service中并保存

[Unit]

Description=Dockem k 4 g .r Application Container Engine

Documentation=https://docs.docker.com

AfterG : ( g H=network-online.target fC L E t 4irewalld.service6 M : v . 1 L / d

Wants=network-online.target

[Service]

Type=notif~ P V : z D 6y

#the default is not to use systemd for cgroups because the deW $ - )legate issues still

#exists and systemd currently does not support the cgroup fea^ } + a [ F ?ture set require[ i ] i h d S ]d

#for containers run by docker

ExecStart=/usr/bin/dockerd

ExecReload=/bin/kill -s HUP $MAINPID

#Having non-zero Lim~ 6 + # B f l Zit*s causes performance problemsN y S ` e & e due to accounting ol Y Xverhead

#in the kernel. We recommend using cgroups tox g J ( n do container-loL l D h | t 1 Wcal accounting.

LimitNOFILE=infinity

LimitNPR3 j h ] 9 L O k #OC=infinity

LimitCORE=infinity_ I u ?

#Uncomment Tasp O T AksMax if yd E Vour systemd version supports it.

#Only systemd 226 and ab` X G G s )ove support this versi{ J _ C X ~on.

#TasksMax=infinity

TimeoA = v 5 m $ iutStartSec=0

#set delegate yes soe % Y S that systemd does not rN Y J } j + `esetb & 7 d A the cgroups of docker containers

Delegate=yes

#kill only the docker process, not all processes in the cgroup

KillMode=process

#restart the docker p& V W % v t g x Mrocess if[ S ^ it exits prematurely

Restart=on-failure

StartLimitBurst=3

StartLimitInterval=60s

[Install]

WantedBy=m` W z Qulti-user.{ 2 y K r a p p Ptarget

4、A n , ~ 启动

chmod +x /etc/systemd/system/V A l g _docker.service #添加文件权限并启动docker

systemctl daemon-reload #重载unit配置文件

systemctl start docker #启动Docker

systemctl enable docker.service #设置开机自启

5、验证f | E b : $ S

sy? i L u y e _ :stemctl status docker #查看Docker状态

docker -v #查看Docker版本