【问题标题】:ERROR: Version in "./docker-compose.yml" is unsupported错误:“./docker-compose.yml”中的版本不受支持
【发布时间】:2019-08-12 05:53:11
【问题描述】:

我在包含相关 docker 文件和 yml 文件的文件夹中运行 docker-compose build。我看到以下错误

root@ubuntu187_demo_2:~/IDOLDockerContainers_12.4.0_COMMON/basic-idol# docker-compose build
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-compose.yml如下

# Basic IDOL container setup
# Uses nifi to ingest and index data into content
# Uses find to make search results available
# Default admin user is created for find in the community service
#  - see community/run_community.sh for details

version: "3.7"

x-args-shared:
  - &idol-version IDOL_VERSION=12.4.0 # version of IDOL components to use

# Change the IP to the address of an external IDOL LicenseServer instance
x-external-licenseserver-host: &external-licenseserver-host
  - "idol-licenseserver:xx.xx.xx.xx"

# Shared volume configuration for nifi and view service - see volumes
x-idol-ingest-volume: &idol-ingest-volume
  - idol-ingest-volume:/idol-ingest

#x-idol-categorisation-volume: &idol-categorisation-volume
#  - idol-categorisation-volume:/idol-categorisation

# Shared volume in NiFi and View
# Any files dropped into this volume will be ingested and indexed
volumes:
  idol-ingest-volume:
# idol-categorisation-volume:

services:
  idol-content:
    image: idol-compose/content
    build:
      context: ./content
      args:
        - *idol-version
    extra_hosts: *external-licenseserver-host
    ports:
      - 9100:9100

docker-compose 版本

root@ubuntu18_demo_2:~/IDOLDockerContainers_12.4.0_COMMON/basic-idol# docker-compose -version
docker-compose version 1.17.1, build unknown

码头工人版本

root@ubuntu18_demo_2:~/IDOLDockerContainers_12.4.0_COMMON/basic-idol# docker -v
Docker version 19.03.1, build 74b1e89

我无法更改 docker-compose.yml 文件的版本。

【问题讨论】:

    标签: docker docker-compose


    【解决方案1】:

    你的 compose 太旧了,如果不能在 compose 中更改版本,请尝试升级到最新的 docker-compose 版本

    sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    

    详情参考this

    【讨论】:

      【解决方案2】:

      我已经通过以下步骤解决了这个问题

      $ sudo apt-get remove docker-compose
      $ sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
      $ sudo chmod +x /usr/local/bin/docker-compose
      $ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
      

      【讨论】:

      • 位置/usr/local/bin/(似乎)的市长流行率高于/usr/bin/,因此不需要符号链接。通过$ export | grep PATH | egrep "/usr/bin|/usr/local/bin"$ whereis docker-compose 验证。下载后需要打开新终端才能生效。 Ubuntu 20.04.1 在这里。
      【解决方案3】:

      使用“sudo”命令对我有用。

      sudo docker-compose up
      

      【讨论】:

      • 使用sudo 是完全没有必要的,也无助于解决 OP 的问题。请不要建议人们在没有充分理由的情况下使用sudo(哪个正在运行的容器不是)
      【解决方案4】:

      我做了以下步骤:

      sudo apt-get remove docker-compose
      sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
      sudo chmod +x /usr/local/bin/docker-compose
      sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
      

      我希望这能解决这个问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-08-10
        • 1970-01-01
        • 2021-05-01
        • 2020-02-13
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多