docker离线安装

有时候docker运行环境连不了互联网,怎么安装呢?这里介绍docker 离线安装方法,非常简单,只需要一个下载包和几个命令就能搞好!

1、去官网下载docker 安装二进制包,选择适合自己的版本。这里下载的是docker-19.03.9.tgz,在centos7中安装(cento6无法使用,提示linux版本内核版本太低)

下载地址:https://download.docker.com/linux/static/stable/x86_64/

2、复制docker-19.03.9.tgz到服务器上,解压:tar xzvf docker-19.03.9.tgz

 

3、进入docker目录复制所有文件到/usr/bin目录下,目的/user/bin是环境变量目录,在路径下都可以运行docker命令

ls -l docker

cp docker/* /usr/bin/

[root@localhost local]# tar xvf docker-19.03.9.tgz
docker/
docker/docker-init
docker/runc
docker/docker
docker/docker-proxy
docker/containerd
docker/ctr
docker/dockerd
docker/containerd-shim
[root@localhost local]# ls -l docker
total 195504
-rwxr-xr-x. 1 lr lr 32751272 May 14 17:29 containerd
-rwxr-xr-x. 1 lr lr 6012928 May 14 17:29 containerd-shim
-rwxr-xr-x. 1 lr lr 18194536 May 14 17:29 ctr
-rwxr-xr-x. 1 lr lr 61113382 May 14 17:29 docker
-rwxr-xr-x. 1 lr lr 68874208 May 14 17:29 dockerd
-rwxr-xr-x. 1 lr lr 708616 May 14 17:29 docker-init
-rwxr-xr-x. 1 lr lr 2928514 May 14 17:29 docker-proxy
-rwxr-xr-x. 1 lr lr 9600696 May 14 17:29 runc
[root@localhost local]# mv docker/* /usr/bin/
[root@localhost local]#

 

 

vim /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

ExecStart=/usr/bin/dockerd

ExecReload=/bin/kill -s HUP $MAINPID

LimitNOFILE=infinity

LimitNPROC=infinity

TimeoutStartSec=0

Delegate=yes

KillMode=process

Restart=on-failure

StartLimitBurst=3

StartLimitInterval=60s

 

[Install]

WantedBy=multi-user.target

 

赋执行权限

chmod +x /etc/systemd/system/docker.service

systemctl daemon-reload 

#开机启动

systemctl enable docker.service

启动docker

systemctl start docker

 

posted @ 2020-07-04 17:02  testway  阅读(25852)  评论(0编辑  收藏  举报