安装
curl -L "https://github.com/docker/compose/releases/download/1.27.4/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.27.4, build 40524192
docker-py version: 4.3.1
CPython version: 3.7.7
OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019
安装补全命令
yum install bash-completion
curl -L https://raw.githubusercontent.com/docker/compose/1.27.4/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
之后退出并重新登录即可
# 连续敲两次 Tab 键
$ docker-compose p
pause port ps pull push
这里由于网络原因可能会下载失败,建议执行完一条下载命令之后用 $? 命令验证是否下载成功