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版本

相关推荐
踩坑小念2 小时前
进程 线程 协程基本概念和区别 还有内在联系
java·linux·jvm·操作系统
yyongsheng3 小时前
SpringBoot项目集成easy-es框架
java·服务器·前端
白小云<3 小时前
docker容器
运维·docker·容器
顾安r3 小时前
10.25 脚本 整理2024全年 GITHUB每周热门项目
linux·c语言·python·github·bash
成都极云科技3 小时前
极智算服务器用的还是自己的网络吗安全吗
服务器
Ronin3053 小时前
【Linux网络】进程间关系与守护进程
linux·网络·守护进程·进程间关系·前台进程·后台进程
脑洞代码3 小时前
ADXL345 SPI加速度传感器Linux驱动开发笔记
linux·驱动开发·笔记
winds~4 小时前
【GUI】本地电脑弹出远程服务器的软件GUI界面
运维·服务器·c++
报错小能手4 小时前
计算机网络自顶向下方法4——详解协议层次及其服务模型
服务器·计算机网络·php