下载docker离线包
下载地址:https://download.docker.com/linux/static/stable/
选择系统架构对应的文件目录:aarch64
我目前使用的docker版本是:docker-24.0.7.tgz
安装docker
# 解压 docker 到当前目录
tar -xvf docker-24.0.7.tgz
# 将 docker 文件移动到 /usr/bin 目录下
cp -p docker/* /usr/bin
准备 docker.service系统配置文件
vi docker.service
docker.service文件内容:
docker.service
[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
将 docker.service 移到 /etc/systemd/system/ 目录
cp docker.service /etc/systemd/system/
# 设置 docker.service 文件权限
chmod +x /etc/systemd/system/docker.service
启动docker
# 重新加载配置文件
systemctl daemon-reload
# 启动docker
systemctl start docker
# 设置 docker 开机自启
systemctl enable docker.service
验证安装是否成功
docker -v
国内加速
参考http://www.884358.com/docker-cmds/#guo_nei_jia_su
安装docker-compose
下载
下载地址:
https://github.com/docker/compose/releases
选择对应系统架构的离线安装包
安装
# 将 docker-compose 文件复制到 /usr/local/bin/ 目录下,并重命名为 docker-compose
cp docker-compose-linux-aarch64 /usr/local/bin/docker-compose
# 设置 docker-compose 文件权限
chmod +x /usr/local/bin/docker-compose
验证
docker-compose -v
参考:https://blog.csdn.net/qq_23845083/article/details/130768859