linux安装docker-compose

Compose 简介

官方文档:https://docs.docker.com/compose/
github地址:https://github.com/docker/compose

Compose项目是 Docker 官方的开源项目,负责实现对 Docker 容器集群的快速编排。

yum快速安装

yum install -y docker-compose

二进制安装最新版本

可以从 官方 GitHub Release 获取二进制包

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

安装指定版本

VERSION=1.24.1
curl -L https://github.com/docker/compose/releases/download/$VERSION/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

# 或使用国内源
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

查看安装版本:

$ docker-compose --version
docker-compose version 1.24.1, build 4667896b

bash 补全命令

https://docs.docker.com/compose/completion/

 curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose --version | awk 'NR==1{print $NF}')/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose

卸载compose

如果是二进制包方式安装的,删除二进制文件即可。

$ sudo rm /usr/local/bin/docker-compose

你可能感兴趣的:(docker)