我已经在CentOS 7上安装了docker,运行如下命令:

curl -sSL https://get.docker.com/ | sh
systemctl enable docker && systemctl start docker
docker run hello-world

注意:helloworld运行正常,没有问题。

然而,当我试图运行docker-compose (docker-compose。yml存在并且有效)它只在CentOS上给了我错误(Windows版本的docker-compose文件工作良好)

/usr/local/bin/docker-compose: line 1: {error:Not Found}: command not found

当前回答

我在debian上,我发现了一些很自然的事情:

apt-get install docker-compose

它做到了 (未测试centos)

其他回答

在Amazon Linux中,如果您将使用哪个docker-compose

您将得到以下错误

[root@ip bin]#哪个docker-compose

no docker-compose in (/sbin:/bin:/usr/sbin:/usr/bin)

只需mv docker-compose从/usr/local/bin到/usr/bin

[root@ip bin]# mv docker-compose /usr/bin

[root@ip bin]#哪个docker-compose

/ bin / sh docker-compose

[root@ip-172-31-36-121 bin]# docker-compose——version

Docker-compose版本1.29.2,构建未知

我在debian上,我发现了一些很自然的事情:

apt-get install docker-compose

它做到了 (未测试centos)

以上的解决方案对我不起作用。但我发现这个很管用:

sudo apt-get update -y && sudo apt-get install -y python3-pip python3-dev
sudo apt-get remove docker docker-engine docker.io
curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo pip3 install docker-compose
#sudo docker-compose -f docker-compose-profess.yml pull ofw
sudo usermod -a -G docker $USER
sudo reboot

docker-compose目前是一个利用docker(-engine)的工具,但没有包含在docker的发行版中。

以下是安装手册的链接: https://docs.docker.com/compose/install/

TL; diana:

curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/bin/docker-compose

(1.8.0将在未来更改)

我建议在Mac上使用官方pkg。我猜docker-compose默认情况下不再包含在docker中:https://docs.docker.com/toolbox/toolbox_install_mac/