错误:“ ./ docker-compose.yml”中的版本不受支持

时间:2019-08-12 05:53:11

标签: docker docker-compose

我正在包含相关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

docker版本

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

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

3 个答案:

答案 0 :(得分: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

答案 1 :(得分:3)

您的撰写太旧,如果您无法更改撰写的版本,请尝试升级到最新的docker-compose版本

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="../style.css">
    <link href="https://fonts.googleapis.com/css?family=Lobster" 
    rel="stylesheet">
</head>
<body>
    <div class="changepassword">
        <h2>Update your password here!</h2>
<form class="signup-form" action="changepassword2.php" method="POST">
   <br></br>
   <label>Username</label>
   <input type="text" name="user_uid" placeholder="Username"> 
   <br></br>
   <label id="temporary_password">Temporary Password</label>
   <br></br>
   <div class="changepassword2">
   <input type="text" name="temporary_password" placeholder="token">
   <br></br>
   <label>New Password</label>
   <input type="password" name="password" placeholder="Password">   
   <br></br>
   <label>Confirm New Password</label>
   <input type="password" name="confirm_password" placeholder="Confirm Password">
   <br></br>

   <button type="submit" name="submit">Update Password</button>
   </div>
    </div>
</body>
</html>

详细信息指的是this

答案 2 :(得分:0)

我做了以下步骤:

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

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