Docker环境离线安装-linux服务器

Linux环境下离线安装docker环境

  • [1. 下载 docker安装包](#1. 下载 docker安装包)
  • [2. 上传到服务器](#2. 上传到服务器)
  • [3. 解压 安装包](#3. 解压 安装包)
  • [4. 将解压文件移动到 /usr/bin 目录下](#4. 将解压文件移动到 /usr/bin 目录下)
  • [5. 编写启动服务](#5. 编写启动服务)
  • [6. 设置开机自启](#6. 设置开机自启)
  • [7. 验证](#7. 验证)

1. 下载 docker安装包

进入官网 https://download.docker.com/linux/static/stable/x86_64/

选择版本进行下载。

2. 上传到服务器

3. 解压 安装包

tar -xzf docker-.tgz

4. 将解压文件移动到 /usr/bin 目录下

sudo mv docker/* /usr/bin/

5. 编写启动服务

vi /etc/systemd/system/docker.service

xml 复制代码
[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

6. 设置开机自启

chmod +x /etc/systemd/system/docker.service #设置权限

systemctl daemon-reload

systemctl start docker #启动Docker

systemctl enable docker.service #设置开机自启

7. 验证

systemctl status docker #查看Docker状态

docker -v #查看Docker版本

相关推荐
wangjialelele14 分钟前
一文读懂 Redis 持久化与事务
linux·数据库·redis·bootstrap
Linux蓝魔18 分钟前
麒麟官方yum源配置V10SP2-V10SP3-V10SP3-2403
大数据·linux·运维
helloliyh19 分钟前
linux 删除指定日期目录(包括目录下文件)
linux·运维·服务器
野犬寒鸦20 分钟前
Redis复习记录Day03
服务器·redis·后端·面试·bootstrap·mybatis
半个俗人30 分钟前
06.Linux用户权限相关命令
linux·运维·服务器
小宇的天下31 分钟前
Calibre LVS Circuit Comparison(1)
linux·数据库·lvs
涛声依旧3931632 分钟前
构建部署kubernetes所需主机
linux·运维·云原生·容器·kubernetes
Chris _data36 分钟前
S7-1500 常用工业通信协议详解与对比
运维·服务器·网络
淼淼爱喝水44 分钟前
OpenEuler 系统下 Ansible 环境部署与连通性测试完整步骤
linux·开发语言·php·openeuler
KuYouRan1 小时前
ubuntu22.04用RTX2060显卡玩steam游戏
linux·其他·ubuntu·游戏