1、环境介绍
[root@VM-0-11-linux ~]# uname -a
Linux VM-0-11-linux 4.19.90-52.22.v2207.ky10.aarch64 #1 SMP Tue Mar 14 11:52:45 CST 2023 aarch64 aarch64 aarch64 GNU/Linux
[root@VM-0-11-linux ~]# cat /etc/kylin-release
Kylin Linux Advanced Server release V10 (Lance)
[root@VM-0-11-linux ~]# uname -p
aarch64
2、下载离线安装包
下载地址: https://mirrors.aliyun.com/docker-ce/linux/static/stable/aarch64/?spm=a2c6h.25603864.0.0.654c4ccaPxer04
选择自己需要的版本并下载。
3、安装docker
[root@VM-0-11-linux ~]# tar -zxvf docker-20.10.10.tgz
docker/
docker/containerd
docker/docker-proxy
docker/dockerd
docker/docker-init
docker/runc
docker/docker
docker/ctr
docker/containerd-shim
docker/containerd-shim-runc-v2
[root@VM-0-11-linux ~]# cp docker/* /usr/bin/
4、配置服务
创建文件:/etc/systemd/system/docker.service,并填充如下内容:
[root@VM-0-11-linux ~]# cat /etc/systemd/system/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
5、启动服务
[root@VM-0-11-linux ~]# chmod +x /etc/systemd/system/docker.service
[root@VM-0-11-linux ~]# systemctl daemon-reload
[root@VM-0-11-linux ~]# systemctl start docker.service
[root@VM-0-11-linux ~]# systemctl enable docker.service
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /etc/systemd/system/docker.service.
[root@VM-0-11-linux ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6、运行容器
如果直接docker run的话,会出现如下的错误:
OCI runtime create failed: container_linux.go:318: starting container process caused "permission denied": unknown
原因分析:
docker:来自守护程序的错误响应:无法创建填充码任务:OCI 运行时创建失败:container_linux.go:318:启动容器进程导致“权限被拒绝”:未知。
解决方案:
卸载Kylin Linux Advanced Server release V10 (Lance) 自带的Podman, 执行:
yum remove podman
之后再次进行docker run