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

相关推荐
骑上单车去旅行13 分钟前
openEuler 22.03 离线源码编译 Zabbix 7.0.27 完整最终整合手册
linux·运维·服务器·zabbix
向日葵.31 分钟前
linux & qnx & git 命令 1
linux·运维·服务器
XLYcmy1 小时前
一个基于 Python 的轻量级 LLM(大语言模型)API 客户端程序:从API交互到LLM应用架构
服务器·python·ai·llm·prompt·agent·token
2023自学中1 小时前
Linux 内核与用户空间 内存管理详解(堆与栈篇)
linux·嵌入式·内存·开发板
极客先躯1 小时前
高级java每日一道面试题-2026年02月09日-实战篇[Docker]-Docker 容器有哪些安全风险?如何缓解?
java·运维·网络·安全·docker·容器
yuanzhengme1 小时前
Ollama【部署 07】搭建本地智能体的简单说明(局域网离线部署Ollama+模型迁移+Docker部署AnythingLLM)
运维·docker·容器·大模型·ollama·本地智能体
想要成为计算机高手1 小时前
用meta quest 3 遥操宇树机器人-xr_teleoperate 复现(含docker安装与配置方式)
人工智能·docker·机器人·xr·g1·具身智能
似水এ᭄往昔1 小时前
【Linux系统编程】--虚拟地址空间
linux·服务器
不会C语言的男孩1 小时前
Linux 系统编程 · 第 3 章:文件 I/O 基础
linux·服务器
硬件工程师宝典1 小时前
I2C从入门到精通之一:I2C的历史起源和综合简介
服务器·嵌入式硬件·硬件架构·i2c