Docker 离线安装指南

发布于:2025-06-11 ⋅ 阅读:(843) ⋅ 点赞:(0)

参考文章

1、确认操作系统类型及内核版本

Docker依赖于Linux内核的一些特性,不同版本的Docker对内核版本有不同要求。例如,Docker 17.06及之后的版本通常需要Linux内核3.10及以上版本,Docker17.09及更高版本对应Linux内核4.9.x及更高版本。我们可以通过在终端执行uname -r命令来查看当前Linux系统的内核版本。

执行uname -r后,输出为:

2、下载Docker安装包

我们需要提前在有网络的环境中下载好Docker的安装包。对于上述系统,对应的下载地址为:

https://download.docker.com/linux/static/stable/aarch64/

3、解压安装包

1、安装tar命令

对于Debian/Ubuntu系统:

sudo apt-get update
sudo apt-get install tar

对于CentOS系统: 

sudo yum install tar

2、将下载的安装包解压,执行命令

tar -xvf docker-24.0.9.tgz

4、拷贝文件

解压后,将解压目录中的所有文件拷贝到/usr/bin目录下,执行命令:

cp docker/* /usr/bin/

5、将Docker注册为service系统服务

1、创建Docker服务的配置文件:

vi /etc/systemd/system/docker.service

2、在打开的文件中,将下列配置添加进去并保存:

[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  --ipv6=false
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、启动Docker

1、为Docker启动脚本赋予执行权限:

chmod +x /etc/systemd/system/docker.service

2、启动Docker服务

systemctl start docker

3、查看状态

systemctl status docker

4、配置开机Docker自启

systemctl enable docker.service

 5、查看Docker的版本信息

docker -v


网站公告

今日签到

点亮在社区的每一天
去签到