离线安装docker

在内网环境下,一般不能联网能在线部署,这时候就需要以离线的方式安装docker。本节内容主要总结离线安装docker的步骤。

1. 下载docker安装包

官方地址:https://download.docker.com/linux/static/stable/x86_64/docker-20.10.12.tgz

由于之前已经下载过,当前文件夹已经提供docker-20.10.12.tgz 可以直接进行使用

2. 解压缩

tar -zxvf docker-20.10.12.tgz

3. 解压的docker文件夹全部移动至/usr/bin目录

cp -p docker/* /usr/bin

4. 将docker注册为系统服务

① 在/usr/lib/systemd/system/目录下,创建docker.service文件

② 编辑docker.service文件

复制代码
 vi /usr/lib/systemd/system/docker.service

Unit

Description=Docker Application Container Engine

Documentation=http://docs.docker.com

After=network.target docker.socket

Service

Type=notify

EnvironmentFile=-/run/flannel/docker

WorkingDirectory=/usr/local/bin

ExecStart=/usr/bin/dockerd \

-H tcp://0.0.0.0:4243 \

-H unix:///var/run/docker.sock \

--selinux-enabled=false \

--log-opt max-size=1g

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=on-failure

Install

WantedBy=multi-user.target

5. 重启生效

重启守护进程

systemctl daemon-reload

systemctl start docker

查看docker状态

systemctl status docker

设置开机启动

#systemctl enable docker

docker version

相关推荐
Patrick_Wilson1 天前
从「改个端口」到 502:Next.js on k8s 的容器端口、Service 映射与 env 覆盖
docker·kubernetes·next.js
Suroy1 天前
DockerView-Go:用 Go 写一个终端 Docker 监控工具,顺便做了个 Web 仪表盘
docker
云恒要逆袭1 天前
运行你的第一个Docker容器
后端·docker·容器
宋均浩2 天前
# Docker 镜像瘦身实战:从 1.2G 到 80MB 的五个优化步骤
ci/cd·docker
程序员老赵3 天前
10 分钟部署 OpenCode:Docker 一键安装,浏览器打开就能用 AI 写代码(附完整命令与排错)
docker·容器·ai编程
WangMingHua1113 天前
LM Studio Docker 部署——本地大模型一键启动
docker
曲幽4 天前
别再用网页翻译看源码了!你的私人翻译神器LibreTranslate,部署避坑指南来了
python·docker·web·pot·translate·libretranslate·arogstranslate
武子康6 天前
调查研究-183 Apple container:Mac 上用轻量 VM 跑 Linux 容器,Swift 会改写本地容器体验吗?
docker·容器·apple
Alsn869 天前
等待学习-学习目录:Docker 容器安全攻防
学习·安全·docker
JLWcai202510099 天前
铸造领域树脂砂轮|金利威多场景解决方案,20 + 配方覆盖全需求
mongodb·zookeeper·eureka·spark·rabbitmq·memcached·storm