官网地址:https://docs.docker.com/compose/install/
运行此命令以下载Docker Compose的当前稳定版本
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
换成国内的
sudo curl -L "https://get.daocloud.io/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
对二进制文件应用可执行权限:
chmod +x /usr/local/bin/docker-compose
安装完成后,可测试 docker-compose --version
常见问题:安装后提示docker-compose找不到
解决方法:编辑配置全局环境变量,再末尾添加以下内容
vi /etc/profile export PATH=/usr/local/bin:$PATH 执行source /etc/profile使配置立即生效