我已经在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
如果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