自学内容网 自学内容网

linux centos7系统ARM架构下安装最新版docker 27.3.1及docker-compose v2.3.4

卸载旧版本的docker 相关安装包

sudo yum remove docker \
         docker-client \
         docker-client-latest \
         docker-common \
         docker-latest \
         docker-latest-logrotate \
         docker-logrotate \
         docker-engine

安装最新版docker,通过以下版本下载arm版本docker包

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

准备docker.service文件

进入到/etc/systemd/system/目录下执行vim 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包解压到你存放的目录

tar -xvf docker-27.3.1.tgz

将解压好docker 文件移动到 /usr/bin 目录下

cp -p docker/* /usr/bin

将 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

启动如果报错,查看一下系统日志

tail -200f /var/log/messages

启动docker

systemctl start docker  

检查 Docker 是否能启动

systemctl status docker  

设置 docker 开机自启

systemctl enable docker

验证安装是否成功

docker --version

配备镜像源

在/etc/docker/daemon.json

{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "registry-mirrors": [
    "https://docker.m.daocloud.io",
    "http://hub-mirror.c.163.com",
    "https://docker.rainbond.cc"
  ],
  "insercure-registries":["本地的IP地址:xxx"],
  "max-concurrent-downloads": 10,
  "log-driver": "json-file",
  "log-level": "warn",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
    },
  "data-root": "/var/lib/docker" 
}

注意daemon.json和docker.service里面的insecture-registry不要重复配置,否则会报错

安装docker-compose

下载arm架构的docker-compose源码安装包
https://github.com/docker/compose/releases?page=8
到存放docker-compose的目录下执行以下命令:

mv docker-compose-linux-aarch64 /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose

查看docker-compose版本

docker-compose --version

原文地址:https://blog.csdn.net/weixin_45797022/article/details/143023056

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!