在使用 Ubuntu 时,运行 docker-compose up -d 命令得到 error:

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 theserviceskey, or omit theversionkey 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/

按提示将 version 改成 2.2 或 3.3,依旧报同样的错。

原因

查阅资料,原来 Ubuntu 支持的最高版本是 docker-compose = 1.25.0

解决方案

升级 docker 和 Docker-compose

sudo cd /usr/local/bin && sudo rm -rf docker-compose
sudo sudo curl -SL https://github.com/docker/compose/releases/download/v2.1.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x docker-compose

成功了:
在这里插入图片描述

参考来源

https://github.com/datahub-project/datahub/issues/2020#issuecomment-1500934962

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐