安装
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh --mirror Aliyun
# 报错
package docker-ce-3:19.03.14-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed
yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm
yum 安装
yum -y update # 更新yum 源
yum install -y epel-release # 安装epel 源
yum clean all # 清除yum 缓存
yum install docker-io -y # 安装docker
修改默认镜像存储位置
systemctl show --property=FragmentPath docker # 查看服务配置位置
yum -y install vim*
vim /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --graph=/mnt/data/docker \ # 修改存储路径 为/mnt/data/docker
启动docker
systemctl daemon-reload # 配置生效
systemctl restart docker # 启动docker
systemctl enable docker.service # 设置Docker 开机启动
安装Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose