(1)使用epel源直接安装(缺点就是版本较低,docker-compose version 1.18.0,)
# yum -y install epel-release
# yum -y install docker-compose
(2)给docker打补丁安装(先安装docker,再docker compose补丁,一般情况是最新版本)
# curl -s -o /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
# yum -y install docker-compose-plugin
# vim /root/.bashrc
...
alias docker-compose='docker compose'
# source /root/.bashrc
# # yum -y remove docker-compose-plugin # 卸载软件
(3)基于二进制安装(需要从GitHub下载软件包,不推荐!速度慢!)
# curl -SL https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
参考链接:
https://docs.docker.com/compose/install/linux/
https://docs.docker.com/compose/install/other/