mohのAI正在绞尽脑汁想思路ING···
mohのAI摘要
mohのAI-Lite

docker和docker-commpose离线安装

背景说明: 本文部署的服务器是 arm架构的

1、安装包下载

docker安装包下载:https://download.docker.com/linux/static/stable/aarch64/

image-20260328234556237

docker-compose安装包下载: https://github.com/docker/compose/releases

image-20260328234616336

2、解压docker安装包

1
tar -xvf docker-25.0.2.tgz

3、解压后会中当前目前下有一个叫docker的文件目录,将该文件夹下的文件拷贝到 */user/bin* 下面

1
cp docker/* /usr/bin/

4、将docker注册为系统服务

创建文件 /etc/systemd/system/docker.service,并添加以下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.serviceWants=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

5、安装docker-compose

将docker-compose-linux-aarch64 文件复制到/usr/local/bin/目录下,并 重命名为docker-compose

1
cp docker-compose-linux-aarch64 /usr/local/bin/docker-compose

6、设置文件文件权限

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

7、重新加载systemd 将新建的docker服务生效

1
systemctl daemon-reload

8、启动docker服务

1
2
3
4
systemctl start docker

查看dokcer状态
systemctl status docker