ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/
今天在部署一个docker项目时,发生了此报错,排查后发现主要原因是docker-compose版本太低了,和/docker-compose.yml 要求的版本对应不上[aru_49]。
解决方案:
进行docker-compose版本升级,直接在github上下载最新版本的程序,对老版本进行覆盖。
注意事项:
首先先查询文件所在路径,不同系统可能所在位置不同,本次操作系统为centos7,请在确认后再进行操作!
查询所在路径:
whereis docker-compose
bash:
下载:
wget "https://ghproxy.com/https://github.com/docker/compose/releases/download/最新版本/docker-compose-linux-x86_64" -O /文件所在路径/docker-compose
示例:
wget "https://ghproxy.com/https://github.com/docker/compose/releases/download/v2.10.1/docker-compose-linux-x86_64" -O /usr/bin/docker-compose
提权:
chmod +x docker-compose
docker-compose --version
本文作者为QioCuIi,转载请注明。