安装CentOS 7

下载一个CentOS 7 精简版:
http://mirrors.163.com/centos/7/isos/x86_64/
选择:CentOS-7-x86_64-Minimal-1503-01.iso
安装好后,配置ip地址,保证能上网。

安装Docker

根据官方安装说明,https://docs.docker.com/installation/centos/

$ cat >/etc/yum.repos.d/docker.repo <<-EOF
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
# yum install docker-engine
# service docker start

安装Docker-compose

先安装pip

# wget  https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py 
# python get-pip.py

再安装compose

# pip install docker-compose

测试案例

下载测试代码

# git clone https://github.com/jiekechoo/docker-haproxy

运行

# cd docker-haproxy
# docker-compose up

浏览器打开本机IP:http://192.168.1.230