Compose 简介
Compose项目是 Docker 官方的开源项目,负责实现对 Docker 容器集群的快速编排。
官方文档:https://docs.docker.com/compose
github地址:https://github.com/docker/compose
awesome-compose: https://github.com/docker/awesome-compose
yum快速安装(默认版本较低):
yum install -y docker-compose
二进制安装
二进制文件下载:https://github.com/docker/compose/releases
使用国内daocloud源安装
version=1.25.4
curl -L https://get.daocloud.io/docker/compose/releases/download/${version}/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
使用官方源安装
version=1.25.4
curl -L https://github.com/docker/compose/releases/download/${version}/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
配置命令补全
https://docs.docker.com/compose/completion/
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
curl -L https://raw.githubusercontent.com/docker/compose/${version}/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
直接安装最新版本
curl -s https://api.github.com/repos/docker/compose/releases/latest \
| grep browser_download_url \
| grep Linux-x86_64 \
| grep -v sha256 \
| cut -d '"' -f 4 \
| xargs curl -Lo /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
查看安装版本:
# docker-compose --version
docker-compose version 1.25.4, build 8d51620a
卸载compose
如果是二进制包方式安装的,删除二进制文件即可。
$ sudo rm /usr/local/bin/docker-compose