我已经在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
尝试在CentOS上使用curl per docker docs安装docker-compose(适用于Linux)。在这些步骤之后,它返回一个错误
docker-compose -v
/usr/local/bin/docker-compose: line 1: Not: command not found
有趣的是,docker-compose文件在第一行只包含“Not Found”(它应该是二进制文件)
cat /usr/local/bin/docker-compose
Not Found
这意味着我试图从github链接卷曲不存在。我失败的链接是:
sudo curl -L "https://github.com/docker/compose/releases/download/2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
在本地运行uname -s和uname -m可以看到需要添加到下载url中的内容
uname -s
Linux
uname -m
x86_64
在浏览器中尝试url
https://github.com/docker/compose/releases/download/2.2.2/docker-compose-linux-x86_64
显示未找到该页面。
一个他们在版本中添加“v”的问题,如v2.2.2。所以下载url应该是v
https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-linux-x86_64。他们的发布:https://github.com/docker/compose/releases/
这是有效的(注意v2.2.2)
sudo curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose -v
Docker Compose version v2.2.2
如果docker-compose已经存在于/usr/local/bin中:
ls -alt /usr/local/bin/ | grep docker-compose
> lrwxr-xr-x 1 root wheel 77 Mar 11 10:39 docker-compose -> /Applications/Docker.app/Contents/Resources/bin/docker-compose/docker-compose
最后用/usr/local/bin更新你的.bash_profile路径:
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH:/usr/local/bin"
Run:
source ~/.bash_profile
并检查:
echo $PATH
> ...
which docker-compose
> /usr/local/bin/docker-compose
docker-compose
我正在安装树莓派3,在树莓操作系统上。curl方法没有解析为有效响应。它还说{错误:未找到},我看了一下URL https://github.com/docker/compose/releases/download/1.11.2/docker-compose-Linux-armv7l,它是无效的。我猜那里没有建筑。
这个指南https://github.com/hypriot/arm-compose对我很有用。
sudo apt-get update
sudo apt-get install -y apt-transport-https
echo "deb https://packagecloud.io/Hypriot/Schatzkiste/debian/ jessie main" | sudo tee /etc/apt/sources.list.d/hypriot.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 37BBEE3F7AD95B3F
sudo apt-get update
sudo apt-get install docker-compose