110 lines
3.2 KiB
Markdown
110 lines
3.2 KiB
Markdown
---
|
||||
|
|
page-title: "麒麟V10(arm64/aarch64)离线安装docker – Jason's Blog"
|
|||
|
|
url: http://www.884358.com/kylinos-docker/
|
|||
|
|
date: "2024-09-25 13:43:43"
|
|||
|
|
---
|
|||
|
|
[跳至正文](http://www.884358.com/kylinos-docker/#content)
|
|||
|
|
|
|||
|
|
## 下载docker离线包
|
|||
|
|
|
|||
|
|
下载地址:[https://download.docker.com/linux/static/stable/](https://download.docker.com/linux/static/stable/ "https://download.docker.com/linux/static/stable/")
|
|||
|
|
选择系统架构对应的文件目录:`aarch64`
|
|||
|
|
|
|||
|
|
我目前使用的docker版本是:`docker-24.0.7.tgz`
|
|||
|
|
|
|||
|
|
## 安装docker
|
|||
|
|
|
|||
|
|
1. `# 解压 docker 到当前目录`
|
|||
|
|
2. `tar -xvf docker-24.0.7.tgz`
|
|||
|
|
|
|||
|
|
4. `# 将 docker 文件移动到 /usr/bin 目录下`
|
|||
|
|
5. `cp -p docker/* /usr/bin`
|
|||
|
|
|
|||
|
|
## 准备 docker.service系统配置文件
|
|||
|
|
|
|||
|
|
1. `vi docker.service`
|
|||
|
|
|
|||
|
|
docker.service文件内容:
|
|||
|
|
|
|||
|
|
1. `docker.service`
|
|||
|
|
|
|||
|
|
3. `[Unit]`
|
|||
|
|
4. `Description=Docker Application Container Engine`
|
|||
|
|
5. `Documentation=https://docs.docker.com`
|
|||
|
|
6. `After=network-online.target firewalld.service`
|
|||
|
|
7. `Wants=network-online.target`
|
|||
|
|
|
|||
|
|
9. `[Service]`
|
|||
|
|
10. `Type=notify`
|
|||
|
|
11. `# the default is not to use systemd for cgroups because the delegate issues still`
|
|||
|
|
12. `# exists and systemd currently does not support the cgroup feature set required`
|
|||
|
|
13. `# for containers run by docker`
|
|||
|
|
14. `ExecStart=/usr/bin/dockerd`
|
|||
|
|
15. `ExecReload=/bin/kill -s HUP $MAINPID`
|
|||
|
|
16. `# Having non-zero Limit*s causes performance problems due to accounting overhead`
|
|||
|
|
17. `# in the kernel. We recommend using cgroups to do container-local accounting.`
|
|||
|
|
18. `LimitNOFILE=infinity`
|
|||
|
|
19. `LimitNPROC=infinity`
|
|||
|
|
20. `LimitCORE=infinity`
|
|||
|
|
21. `# Uncomment TasksMax if your systemd version supports it.`
|
|||
|
|
22. `# Only systemd 226 and above support this version.`
|
|||
|
|
23. `#TasksMax=infinity`
|
|||
|
|
24. `TimeoutStartSec=0`
|
|||
|
|
25. `# set delegate yes so that systemd does not reset the cgroups of docker containers`
|
|||
|
|
26. `Delegate=yes`
|
|||
|
|
27. `# kill only the docker process, not all processes in the cgroup`
|
|||
|
|
28. `KillMode=process`
|
|||
|
|
29. `# restart the docker process if it exits prematurely`
|
|||
|
|
30. `Restart=on-failure`
|
|||
|
|
31. `StartLimitBurst=3`
|
|||
|
|
32. `StartLimitInterval=60s`
|
|||
|
|
|
|||
|
|
34. `[Install]`
|
|||
|
|
35. `WantedBy=multi-user.target`
|
|||
|
|
|
|||
|
|
## 将 docker.service 移到 /etc/systemd/system/ 目录
|
|||
|
|
|
|||
|
|
1. `cp docker.service /etc/systemd/system/`
|
|||
|
|
2. `# 设置 docker.service 文件权限`
|
|||
|
|
3. `chmod +x /etc/systemd/system/docker.service`
|
|||
|
|
|
|||
|
|
## 启动docker
|
|||
|
|
|
|||
|
|
1. `# 重新加载配置文件`
|
|||
|
|
2. `systemctl daemon-reload`
|
|||
|
|
|
|||
|
|
4. `# 启动docker`
|
|||
|
|
5. `systemctl start docker`
|
|||
|
|
|
|||
|
|
7. `# 设置 docker 开机自启`
|
|||
|
|
8. `systemctl enable docker.service`
|
|||
|
|
|
|||
|
|
## 验证安装是否成功
|
|||
|
|
|
|||
|
|
1. `docker -v`
|
|||
|
|
|
|||
|
|
## 国内加速
|
|||
|
|
|
|||
|
|
参考http://www.884358.com/docker-cmds/#guo\_nei\_jia\_su
|
|||
|
|
|
|||
|
|
## 安装docker-compose
|
|||
|
|
|
|||
|
|
### 下载
|
|||
|
|
|
|||
|
|
下载地址:
|
|||
|
|
https://github.com/docker/compose/releases
|
|||
|
|
选择对应系统架构的离线安装包
|
|||
|
|

|
|||
|
|
|
|||
|
|
### 安装
|
|||
|
|
|
|||
|
|
1. `# 将 docker-compose 文件复制到 /usr/local/bin/ 目录下,并重命名为 docker-compose`
|
|||
|
|
2. `cp docker-compose-linux-aarch64 /usr/local/bin/docker-compose`
|
|||
|
|
3. `# 设置 docker-compose 文件权限`
|
|||
|
|
4. `chmod +x /usr/local/bin/docker-compose`
|
|||
|
|
|
|||
|
|
### 验证
|
|||
|
|
|
|||
|
|
1. `docker-compose -v`
|
|||
|
|
|
|||
|
|
参考:https://blog.csdn.net/qq\_23845083/article/details/130768859
|