Installing Docker and Docker-Compose on ARM64 Servers

1. Download the docker-ce package

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

2. Extract the files and copy them to /usr/local/bin

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

3. Create the docker.service file

$ 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

4. Mount the default storage path for Docker [optional]

The default working path for Docker is /var/lib/docker. It is best not to change the default storage path; you can create a symbolic link instead.

# Create working directory
$ mkdir /home/application/

# Format the disk
$ mkfs.ext4 /dev/sdb

# Permanently mount the disk
$ vim /etc/fstab
/dev/sdb  /home/application  ext4 defaults 00

# Make the mount effective
$ mount -a

# Create Docker working directory
$ mkdir -p /home/application/docker

# Create symbolic link
$ ln -s /home/application/docker /var/lib/

5. Add executable permissions

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

6. Start, load, and enable on boot

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

7. Configure image accelerator and log management

$ sudo mkdir -p /etc/docker
$ sudo tee /etc/docker/daemon.json <<-'EOF'
{
   "registry-mirrors": [
     "https://docker.1ms.run",
     "https://docker.1panel.live/"
   ]
 }
EOF
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker

8. Download the corresponding binary package directly on AArch64 systems

$ 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
$ docker-compose version

9. If an error occurs after starting the Docker container

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: container_linux.go:318: starting container process caused “permission denied”: unknown.
# Remove the pre-installed Podman
$ yum remove podman

# Then execute the command to start the container

Leave a Comment