解决:You might be seeing this error because you‘re using the wrong Compose file version
Posted Data-Mining
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决:You might be seeing this error because you‘re using the wrong Compose file version相关的知识,希望对你有一定的参考价值。
目录
问题
今天使用 docker-compose 启动服务的时候,遇到了如下报错信息:
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 verson of "2"(or "2.0") 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.
报错截图:
解决
想要解决上述问题,有两种方法,大家可以根据自己的需要进行选择。
下面分别介绍这两种方法。
方法一、升级 docker-compse 版本
1. 下载安装包并解压到指定目录,命令如下:
sudo curl -L https://github.com/docker/compose/releases/download/1.13.0/docker-compose-Linux-x86_64 -o /usr/local/bin/docker-compose
2. 修改 docker-compose 的可执行权限,命令如下:
sudo chmod +x /usr/local/bin/docker-compose
现在再执行 docker-compose up 命令,报错消失,问题解决。
方法二、修改配置文件信息
我们知道 docker-compose.yml 配置文件一般都是 version 字段开头,当前 version 版本是 3,根据报错提示的信息,我们可以直接修改 version 字段为 2,或者 2.0。
比如:
version: '2'
services:
minio:
修改配置文件后,再执行 docker-compose up 命令,报错消失,问题解决。
以上是关于解决:You might be seeing this error because you‘re using the wrong Compose file version的主要内容,如果未能解决你的问题,请参考以下文章
The folder can’t be opened because you don’t have permission to see its contents.
Error resolving template [favicon.ico], template might not exist or might not be accessible by any o
报错Error resolving template template might not exist or might not be accessible解决方案
failed to sync branch You might need to open a shell and debug the state of this repo.
怎么解决might not be accessible by any of the configured template resolvers
SpringBoot+Thyemleaf开发环境正常,打包jar发到服务器就报错Template might not exist or might not be accessible