1、在 centos 上安装 docker-ce
- 配置docker-ce环境
# 配置repo源
# 配置repo源
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
# 安装最新版本docekr-ce (通常如果有条件的话可以定期更新一下docker-ce)
# 配置repo源
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
# 安装最新版本docekr-ce (通常如果有条件的话可以定期更新一下docker-ce)
yum -y install docker-ce
systemctl enable docker.service
systemctl start docker.service
docker version
# 配置docker镜像加速
# 配置default-address-pools, 防止自动创建的容器网络冲突
# 配置log-opts, max-size为文件最大大小,max-file为最多保持几个文件
cat <<EOF > /etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com","http://hub-mirror.c.163.com"],
"default-address-pools" : [{"base":"172.100.0.0/16","size":24}]
"log-opts": {"max-size": "10m", "max-file": "1"}
}
EOF
systemctl restart docker.service
- 配置docker-compose
# git地址 https://github.com/docker/compose (版本选择,下载速度有点慢,可以考虑拷贝)
# curl -L "https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# 这是保存在向上oss上的文件,可以直接下载拿来用
curl -L https://xs-data-backup.oss-cn-hangzhou.aliyuncs.com/docker-compose/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version
标签:compose,com,ce,repo,yum,docker,安装
From: https://www.cnblogs.com/shijunjie/p/17027913.html