CentOS7离线环境安装Docker-CE各种版本

前言

目前,CentOS 仅发行版本中的内核支持 Docker

Docker 运行在 CentOS 7 上,要求系统为64位、系统内核版本为 3.10 以上

Docker 运行在 CentOS-6.5 或更高的版本的 CentOS 上,要求系统为64位、系统内核版本为 2.6.32-431 或者更高版本

本文以CentOS7 内核版本3.10.0-957,docker-ce版本 18.09.4 为例

一、基础环境

1.1 操作系统

1.2 Docker版本:18.09.4 官方下载地址

1.3 参考文档:官方文档:https://docs.docker.com/install/linux/docker-ce/binaries/#install-static-binaries

二、安装步骤

2.1 检验系统内核版本:

[root@localhost ~]# uname -r

2.2 提前下载好docker的tar.gz文件,地址 点击这里

2.3 上传到离线服务器上

2.4 解压 docker-18.09.4-ce.tgz

[root@localhost ~]# tar -xvf docker-18.09.4-ce.tgz

2.5 将解压出来的docker文件夹内所有内容移动到 /usr/bin/ 目录下

[root@localhost ~]# cp docker/* /usr/bin/

2.6 将docker注册为service

[root@localhost ~]# vi /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

2.7 添加docker.service文件权限

[root@localhost ~]# chmod +x /etc/systemd/system/docker.service

2.8 启动docker并设置开机自启

[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl start docker
[root@localhost ~]# systemctl enable docker.service

2.9 验证一下

[root@localhost ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since 五 2019-08-02 08:53:36 CST; 4 days ago
     Docs: https://docs.docker.com
 Main PID: 14136 (dockerd)
    Tasks: 295
   Memory: 809.3M
   CGroup: /system.slice/docker.service

看到running就表示运行起来了

还可以查看一下docker版本

[root@localhost ~]# docker -v
Docker version 18.09.4, build d14af54266

至此,安装成功,其他版本的安装也是类似的

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值