centOS7.3 离线安装docker

Posted always-fight

tags:

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

一、环境

 因某些环境,不能联外网,所以使用docker yum源方法行不通,于是打算离线安装

 环境:contos7.3(内核需为3.10+)

cat /etc/redhat-release
# CentOS Linux release 7.3.1611 (Core) 

 下载:docker-18.06.3-ce.tar

 

二、安装步骤

 1)setup

cd /usr/local/resource/docker
tar -xzvf docker-18.06.3-ce.tar
mv  /usr/local/resource/docker/docker/*  /usr/bin/ # 将二进制文件移动到bin下

  2)systemd docker.service

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
# 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 -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
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

  授予执行权限:

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

  然后:

systemctl daemon-reload   # 重载systemd下 xxx.service文件
systemctl start docker       # 启动Docker
systemctl enable docker.service   # 设置开机自启

  测试是否成功:

systemctl status docker   # 查看Docker状态
docker -v # 查看Docker版本

  

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

Centos7.3离线安装docker18.09.9

docker中基于centos7.3搭建tesseract5环境以及制作镜像

docker中基于centos7.3搭建tesseract5环境以及制作镜像

系列CentOS 7.3 离线安装(无网络环境)CI CD环境之harbor

centos7.3离线安装telnet用于升级openssh

Centos7.3离线(tar方式)安装mysql服务