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

相关推荐
一个平凡而乐于分享的小比特8 分钟前
Linux内核中的container_of宏详解
linux·container_of
csdn_aspnet7 小时前
TCP/IP协议栈深度解析:从基石到前沿
服务器·网络·tcp/ip
lcreek7 小时前
Linux信号机制详解:阻塞信号集与未决信号集
linux·操作系统·系统编程
shandianchengzi7 小时前
【记录】Tailscale|部署 Tailscale 到 linux 主机或 Docker 上
linux·运维·docker·tailscale
John Song8 小时前
Linux机器怎么查看进程内存占用情况
linux·运维·chrome
sichuanwuyi8 小时前
Wydevops工具的价值分析
linux·微服务·架构·kubernetes·jenkins
持戒波罗蜜8 小时前
ubuntu20解决intel wifi 驱动问题
linux·驱动开发·嵌入式硬件·ubuntu
不做无法实现的梦~8 小时前
使用ros2来跑通mid360的驱动包
linux·嵌入式硬件·机器人·自动驾驶
梁辰兴9 小时前
计算机网络基础:虚拟专用网
服务器·网络·计算机网络·vpn·虚拟专用网·计算机网络基础·梁辰兴
点云SLAM9 小时前
C++内存泄漏检测之Windows 专用工具(CRT Debug、Dr.Memory)和Linux 专业工具(ASan 、heaptrack)
linux·c++·windows·asan·dr.memory·c++内存泄漏检测·c++内存管理