1. 说明
系统镜像使用的是Kylin-Server-V10-SP3-2403-Release-20240426-x86_64.iso 如果是在VMware中安装这个系统,需选择Ubuntu,如果选Centos会有问题。 尝试使用在线方式安装docker,报了很多错误,比较麻烦,建议使用离线方式安装。下面是离线包下载路径,根据服务器架构信息下载对应的安装包。本文将介绍离线安装的方式。 docker安装包下载目录:http://mirrors.aliyun.com/docker-ce/linux/static/stable docker-compose安装包下载目录:https://github.com/docker/compose/releases
2. 安装步骤
根据操作系统及架构下载对应的docker和docker-compose包
[ root@localhost ~]
Kylin Linux Advanced Server release V10 ( Halberd)
[ root@localhost ~]
x86_64
[ root@localhost ~]
4.19 .90-89.11.v2401.ky10.x86_64
[ root@localhost ~]
iptables v1.8.5 ( legacy)
在根目录创建文件夹docker,将docker及docker-compose安装包上传至此目录,解压
cd /
mkdir docker
cd docker/
tar -zxvf docker-26.1.4.tgz
mv docker/* /usr/bin/
dockerd
添加docker.service
vim /usr/lib/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
ExecStart = /usr/bin/dockerd
ExecReload = /bin/kill -s HUP $MAINPID
LimitNOFILE = infinity
LimitNPROC = infinity
TimeoutStartSec = 0
Delegate = yes
KillMode = process
Restart = on-failure
StartLimitBurst = 3
StartLimitInterval = 60s
[ Install]
WantedBy = multi-user.target
为docker.service赋权限并重新加载
chmod +x /usr/lib/systemd/system/docker.service
systemctl daemon-reload
创建docker数据存储目录,并编辑daemon.json
mkdir data
vim daemon.json
{ "data-root" : "/docker/data"
}
mkdir -p /etc/docker/ && cp /docker/daemon.json /etc/docker/
启动
systemctl start docker
systemctl enable docker
docker -v
安装docker-compose
cp docker-compose-linux-x86_64 /usr/bin/docker-compose && chmod +x /usr/bin/docker-composedocker-compose version