一、常见CPU 架构:

image-20241127134352237

二、环境信息

CPU架构 操作系统 配置
HUAWEI Kunpeng 920 5220 aarch64 openEuler 22.03 (LTS-SP3) 64C128g15T

三、安装docker

3.1 二进制包下载

docker-ce 社区下载地址:

wget https://mirrors.nju.edu.cn/docker-ce/linux/static/stable/aarch64/docker-27.1.2.tgz

3.2 解压,拷贝至/usr/bin 下

tar -xf docker-27.1.2.tgz
cp docker/* /usr/bin
which docker

3.3 编写docker.service文件

cat > /etc/systemd/system/docker.service <<EOF

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target

[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=65535
LimitNPROC=65535
LimitCORE=65535
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target

EOF

3.4 挂载docker默认存储路径[可选]

docker的默认工作路径在/var/lib/docker ,最好不修改默认存储路径,可以做软链接

#建立工作目录
mkdir /home/application/

#格式化磁盘
mkfs.ext4 /dev/sdb

#磁盘永久挂载
vim /etc/fstab
/dev/sdb  /home/application  ext4 defaults 0 0

#使挂载生效
mount -a


# 创建docker 工作目录
mkdir -p /home/application/docker


#创建软链接
ln -s /home/application/docker /var/lib/

3.5 添加可执行权限

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

3.6 启动,加载,开机自启动

systemctl daemon-reload
systemctl start docker.service
systemctl enable docker.service

3.7 配置镜像加速器,日志管理

mkdir -p /etc/docker

tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://docker.m.daocloud.io"],
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  }
}
EOF

systemctl daemon-reload
systemctl restart docker

如果仓库不是https 的,需要在 /etc/docker/daemon.json 中 添加忽略;比如下方的示例

"insecure-registries": [
    "https://xx.xx.com",
    "https://xx.xx.cc.xx.com"
  ]

四、Docker编排工具Docker Compose

4.1 在AArch64位系统上直接下载对应的二进制包

wget https://github.com/docker/compose/releases/download/v2.29.3/docker-compose-linux-aarch64  -O /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

4.2 版本验证

[root@localhost ~]# docker-compose version
Docker Compose version v2.29.3