Docker离线安装

Posted Hello、Lin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker离线安装相关的知识,希望对你有一定的参考价值。

离线安装Docker

1、下载docker 离线安装包

​ 下载地址如下:Index of linux/static/stable/x86_64/

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

我这里下载的是20.10.9

3、解压文件

tar -zxvf docker-20.10.9.tgz

解压后的文件如下所示

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

7、 添加可执行权限

chmod +x docker.service

8、加载docker.service

systemctl daemon-reload

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

9、启动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

redhat7.5 离线安装docker

参考技术A https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz

vi /etc/systemd/system/docker.service

systemctl enable docker

以上是关于Docker离线安装的主要内容,如果未能解决你的问题,请参考以下文章

windows server 离线安装docker

centos 7离线安装docker, 离线安装docker-compose

centos6离线安装docker

docker离线安装

离线安装Docker

linux离线安装docker服务