$ docker version
$ sudo yum update
$ sudo yum remove docker docker-common docker-selinux docker-engine
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
$ yum list docker-ce --showduplicates | sort -r
#这里安装默认最新的即可
$ sudo yum install docker-ce
#若安装默认版本失败,也可以指定安装某个版本
$ sudo yum install <FQPN> # 例如:sudo yum install docker-ce-17.12.0.ce
$ sudo systemctl start docker
$ sudo systemctl enable docker
$ docker version
$ docker-compose --version
#这里建议直接安装2.2.2版本即可,如果要安装其他版本,替换v2.2.2。
$ sudo curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose --version
$ docker pull mysql:8.0.26
##使用阿里云镜像加速器
[root@localhost ~]# mkdir -p /etc/docker
[root@localhost ~]# tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://9cpn8tt6.mirror.aliyuncs.com"]
}
EOF
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl restart docker
cd {path} (用项目的路径替换{path})
# -d参数表示后台运行,不加-d参数可以查看部署状态。建议先执行docker-compose up命令检验是否正确部署,然后再退出,进行后台部署
docker-compose up -d
http://172.26.0.13:8002 (局域网)
用户名:honghong 密码:123456