麒麟 V10 系统(arm64/aarch64)离线安装 docker 和 docker-compose
前期准备
查看操作系统版本,跟本文标题核对一下
uname -a
查看操作系统架构
uname -m
下载离线包
下载 docker 离线包
地址:https://download.docker.com/linux/static/stable/
选择系统架构对应的文件目录:aarch64,我目前使用的版本是:24.0.6
下载 docker-compose 离线包
地址:https://github.com/docker/compose/releases
选择系统架构对应的文件目录:aarch64,我目前使用的版本是:2.30.1
修改 docker 存储路径
修改存储目录至数据盘,避免后期埋坑,系统盘炸裂
mkdir /etc/docker
vim /etc/docker/daemon.json
{
"data-root": "/data/docker/root_dir/"
}
准备 docker.service 系统配置文件
其中, --default-ulimit nofile=65535:65535,这个对 java 程序能在容器中愉快的运行十分重要!
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 --default-ulimit nofile=65535:65535
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
一把梭
# 进入安装文件存放目录
cd /data/soft
# 解压 docker 到当前目录
tar -xvf docker-24.0.6.tgz
# 将 docker 文件移动到 /usr/bin 目录下
cp -p docker/* /usr/bin
# 将 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.service 移到 /etc/systemd/system/ 目录
cp docker.service /etc/systemd/system/
# 设置 docker.service 文件权限
chmod +x /etc/systemd/system/docker.service
# 重新加载配置文件
systemctl daemon-reload
# 启动docker
systemctl start docker
# 设置 docker 开机自启
systemctl enable docker.service
验证
查看 docker 版本
docker -v
查看 docker-compose 版本
docker-compose -v
原文地址:https://blog.csdn.net/z1353095373/article/details/143889845
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!