1 版本声明
需要根据操作系统的框架选择Docker的框架。
1.1 查看操作系统的框架
使用下列命令可以查看操作系统版本
uname -a
得到操作系统如下图为银河麒麟ARM64框架
1.2 选择Docker的版本
根据操作系统的框架选择Docker的框架,也为arm64框架(也可以叫做aarch64框架)
下载路径为:Docker安装包的下载地址
首先点击相对于的框架:
再下载一个安装包,这里我下载的是docker-20.10.7.tgz:
1.3 选择docker-compose的版本
下载路径为:
docker-compose安装包的下载地址
直接点击对应的arm64的框架安装包进行下载
2 安装Docker
2.1 准备配置文件
需要提前准备一个Docker的配置文件
输入下列指令编辑配置文件:
sudo vim /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
2.2 命令安装Docker和 Docker Compose
2.2.1 Docker 与 Docker Compose 手动安装配置指南
1)解压docker
tar xvf docker-20.10.7.tgz
2)将docker 文件移动到 /usr/bin 目录下
cp -p docker/* /usr/bin/
3)将ocker-compose-linux-aarch64 文件复制到 /usr/local/bin/ 目录下,并重命名为 docker-compose
cp docker-compose-linux-aarch64 /usr/local/bin/docker-compose
4)设置 docker-compose 文件权限
chmod +x /usr/local/bin/docker-compose
5)设置 docker.service 文件权限
chmod +x /etc/systemd/system/docker.service
重新加载配置文件
systemctl daemon-reload
2.2.1 启动Docker
使用下列命令启动docker
systemctl start docker
设置 docker 开机自启
systemctl enable docker.service
2.2.2 验证安装是否成功
使用下列的命令验证Docker安装是否成功
docker -v
出现下列的Docker版本信息代表已经安装成功