Docker Compose
是一个部署多个容器的简单但是非常必要的工具,在实际工作中非常有价值,相信随着Docker Compose的完善,其必将取代docker run
成为开发者启动docker容器的首选。
参考
Docker集群管理之Docker Compose 从入门到实战:Compose
安装
参考官网安装
先将 docker engine
升级到 v1.12.
BUG
使用curl
安装遇到证书问题
# curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0curl: (77) error setting certificate verify locations:
CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
Debug
- 尝试一
tried uninstalling and reinstalling curl in Ubuntu, and updating my CA certs with $ sudo update-ca-certificates --fresh
which updated the certs。
依旧报如上的错误
- 尝试二
from googling, the
CAfile
location it is looking for is not correct for Ubuntu (and it doesn’t exist on my computer), while ` /etc/ssl/certs/ca-certificates.crt ` is the proper location. Most of the solutions involved setting the environment variableCURL_CA_BUNDLE
to the proper location(I don’t know how to set), or addingcacert=/etc/ssl/certs/ca-certificates.crt
to the (newly created).curlrc
file in my home directory(vimamy/.curlrc
androot/.curlrc
together).
root@ubuntu-host2:~# sudo vim ~/.curlrc
~cacert=/etc/ssl/certs/ca-certificates.crt
~
root@ubuntu-host2:~# source ~/.curlrc
root@ubuntu-host2:~# curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 600 0 600 0 0 188 0 --:--:-- 0:00:03 --:--:-- 511
100 7783k 100 7783k 0 0 23209 0 0:05:43 0:05:43 --:--:-- 16588
root@ubuntu-host2:~# chmod +x /usr/local/bin/docker-compose
root@ubuntu-host2:~# docker-compose --version
docker-compose version 1.8.0, build f3628c7
Here 安转完成。Bravo!!
也可以使用pip安装
若使用pip
从 pypi
安装,最好使用virtualenv
避免各个版本编译器冲突。
Compose can be installed from pypi using pip. If you install using pip it is highly recommended that you use a virtualenv because many operating systems have python system packages that conflict with docker-compose dependencies. See the virtualenv tutorial to get started.