## 1、安装docker  
#### （1）在线安装
` curl -sSL https://get.daocloud.io/docker | sh `

#### （2）离线安装  

**参考地址：**[安装教程1](https://www.cnblogs.com/royfans/p/16590987.html)
[安装教程2](https://blog.csdn.net/zhiboqingyun/article/details/113172501)
[安装教程3](https://www.jianshu.com/p/3d88d08f112c)

##### 2.1 下载docker-20.10.23
[docker-20.10.23.tgz官方下载地址](https://download.docker.com/linux/static/stable/x86_64/docker-20.10.23.tgz)

##### 2.2 上传tgz到服务器[/data/software]，解压缩并迁移命令
```
# cp /data/software

# tar -zxvf docker-20.10.23.tgz

# cp -pf docker/* /usr/bin

```

##### 2.3 将docker注册为系统服务

``` 
# vim /usr/lib/systemd/system/docker.service 

[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target docker.socket
[Service]
Type=notify
EnvironmentFile=-/run/flannel/docker
WorkingDirectory=/usr/local/bin
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock --selinux-enabled=false
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=on-failure
[Install]
WantedBy=multi-user.target
```

##### 2.4 执行(3)配置docker私服地址和镜像加速

##### 2.5 启动docker
```
# systemctl daemon-reload

# systemctl start docker

# systemctl enable docker  // 开机启动

# docker info
```

#### （3）设置docker国内镜像加速、私服地址、镜像存储位置
``` 
# mkdir -p /data/docker/lib && mkdir /etc/docker

# vim /etc/docker/daemon.json
{
"registry-mirrors": [
	"https://hub-mirror.c.163.com/", 
	"https://mirror.ccs.tencentyun.com", 
	"https://mirror.baidubce.com"
 ],
 "insecure-registries": [
   "docker.platomix.net:10000"
 ],
 "data-root": "/data/docker/lib"
}

# systemctl start docker
```

## 2、安装docker-compose[版本号：2.15.0]

#### (1)上传docker-compose上传到/data/software
根据CPU内核架构([`uname -m`]命令可以查看内核架构)选择对应的下载地址。
[aarch64下载地址](https://github.com/docker/compose/releases/download/v2.15.0/docker-compose-linux-aarch64)
[x86_64下载地址](https://github.com/docker/compose/releases/download/v2.15.0/docker-compose-linux-x86_64)

``` 
# cd /data/software

//根据自己下载的文件名 重命名为 docker-compose
# mv docker-compose-linux-aarch64 docker-compose 或者 mv docker-compose-linux-x86_64 docker-compose

# cp docker-compose /usr/local/bin 

# chmod a+x /usr/local/bin/docker-compose
	
# ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

# docker-compose --version
```

#### (2)在线下载docker-compose
```
# curl -L https://get.daocloud.io/docker/compose/releases/download/v2.15.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod a+x /usr/local/bin/docker-compose

# chmod a+x /usr/local/bin/docker-compose

# ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

# docker-compose --version
```