一、安装docker
安装需要的软件包(yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的)
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
设置yum源
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
安装docker
$ sudo yum install docker-ce
启动并加入开机启动
$ sudo systemctl start docker $ sudo systemctl enable docker
二、安装docker-compose
下载docker-compose
$ curl -L https://github.com/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
授权docker-compose
$ chmod +x /usr/local/bin/docker-compose
验证
$ docker-compose version