Docker 18.09离线安装

Docker 18.09 离线安装

docker

目录

{{TOC}}

背景环境说明

操作系统: Redhat 7.5 X86
内核: 3.10.0-862.el7.x86_64
需要离线安装docker 18.09

网上很多种方式,yum安装什么的,总是会缺各种包。不建议使用。 直接上大招, 使用binaries 直接安装。

官方二进制包安装文档

主要步骤

  1. 准备工作,下载bin包
  2. 配置Docker的一些配置文件
  3. 验证Docker

详细步骤

1. 检查ROOT权限(可选)

如果已经有管理员权限,可以跳过。

# vi /etc/sudoers

root ALL=(ALL) ALL 
k8sadmin ALL=(ALL) ALL  (添加本行)

确认可以执行执行 sudo 表示配置没问题。

2. 下载Docker离线安装包

二进制包,即可以直接使用的软件,无需再编译配置。但是需要选对平台,如X86 AIX等平台。
Docker官方Bin包下载地址
阿里云Docker镜像Bin包地址
这里选择正确的版本,选择18.09最新版本。

3. 准备Docker一些配置文件

创建一个目录,假设为: /home/k8sadmin/docker-install/

配置dasmon.json

在工作目录创建 daemon.josn,也可以直接配置/etc/docker/daemon.json文件,

{
    "insecure-registries": [
        "10.16.43.130:5080",
        "registry.scrcu.com:80"
    ],
    "registry-mirrors":[
        "https://d8b3zdiw.mirror.aliyuncs.com"
    ],
    "data-root": "/data/docker"
} 

daemon.json指定用户运行docker参数,常用的还有一些:

insecure-registries: 不使用https的镜像仓库
graph: docker运行时文件存档路径\(v18.06之前的版本可以用,后面用data-root替换)
log-driver: 日志驱动
data-root: 新版本 替换graph的新参数(v18.09)

配置docker.service

可以从其他docker安装后的文件/usr/lib/systemd/system/docker.service copy过来。 这里提供docker 18.09的范例,后续docker版本可能会变化:

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
#BindsTo=containerd.service.  — 无需containerd。
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 unix://
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3

# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s

# 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

# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this option.
TasksMax=infinity

# 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

[Install]
WantedBy=multi-user.target

好了到此你的文件夹应该有以下的文件列表:

# ls -1
daemon.json
docker-18.09.4.tgz
docker.service

4. 离线安装/配置Docker

创建Shell执行或者手动执行:

#:
echo " 1. unzip the docker bin."
tar zxvf docker-18.09.4.tgz
echo " 2. move docker* into /usr/bin "
cp docker/* /usr/bin/
#vi /etc/daemon.json
echo " 3. copy daemon.json, docker service into system "
mkdir /etc/docker
cp daemon.json /etc/docker/daemon.json
cp docker.service /usr/lib/systemd/system/docker.service
echo " 4. docker install successfully !, check docker info to see the result."

5. 启动验证

启动docker服务,设置开机启动服务。

systemctl daemon-reload
systemctl start docker 
systemctl enable docker

#查看docker返回信息
docker info 
#运行官方验证程序。
docker run hello-world 

参考资料

远程下发:

scp -r docker_install k8sadmin@10.16.2.211:~
scp -r docker_install k8sadmin@10.16.2.212:~
scp -r docker_install k8sadmin@10.16.2.213:~
scp -r docker_install k8sadmin@10.16.2.214:~

特别说明

版本信息

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 158,847评论 4 362
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,208评论 1 292
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 108,587评论 0 243
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,942评论 0 205
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,332评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,587评论 1 218
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,853评论 2 312
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,568评论 0 198
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,273评论 1 242
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,542评论 2 246
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,033评论 1 260
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,373评论 2 253
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,031评论 3 236
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,073评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,830评论 0 195
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,628评论 2 274
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,537评论 2 269

推荐阅读更多精彩内容