1、centos系统安装docker命令
// 安装yum
yum install -y yum-utils
// 配置Docker的yum源
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
//或者配置阿里的yum源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
// 安装docker
yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
2、检查是否安装成功
// An highlighted block
# 启动
systemctl start docker
# 停止
systemctl stop docker
# 重启
systemctl restart docker
# 如果不报错,安装启动成功
docker ps
3、设置开机自启动
systemctl enable docker
4、配置阿里云镜像加速
https://www.aliyun.com/
(1)开通服务
(2)配置镜像加速
(3)配置命令
# 创建目录
mkdir docker
# 注意修改加速地址
tee /docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxxx.mirror.aliyuncs.com"]
}
EOF
# 重新加载配置
systemctl daemon-reload
# 重启Docker
systemctl restart docker
2、 安装docker-compos工具
(1)下载docker-compose文件
curl -L https://github.com/docker/compose/releases/download/1.21.1/docker-compose-uname -s
-uname -m
-o /usr/local/bin/docker-compose
(2)将文件复制到/usr/local/bin环境变量下面
mv docker-compose /usr/local/bin
(3)配置执行权限
chmod +x /usr/local/bin/docker-compose
(4)查看是否安装成功
docker-compose -version
(5) 卸载docker-compose
rm /usr/local/bin/docker-compose