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

相关推荐
网络小白不怕黑3 小时前
Docker容器网络:四大模式解析与自定义网络
运维·docker·容器
徐子元竟然被占了!!3 小时前
Linux-systemctl
linux·数据库·oracle
_w_z_j_6 小时前
Linux----mmap
linux
程序员zgh7 小时前
Linux系统常用命令集合
linux·运维·服务器·c语言·开发语言·c++
gwd2007 小时前
如何快速设置 Docker 代理设置
运维·人工智能·docker·容器
Bigan(安)8 小时前
【奶茶Beta专项】【LVGL9.4源码分析】09-core-obj_class对象类系统
linux·c语言·mcu·arm·unix
紫郢剑侠8 小时前
飞秋@Windows +iptux@Linux,打造内网跨平台IM环境
linux·运维·服务器·im·qq
保持低旋律节奏8 小时前
linux——调试
linux·运维·服务器
牛奶咖啡138 小时前
Linux系统故障排查思路实践教程(下)
linux·运维·服务器·su命令切换用户问题解决·文件打开过多问题解决·linux网络故障问题解决·linux故障排查思路