Vinay Joseph
Vinay Joseph

Reputation: 5655

ERROR: Version in "./docker-compose.yml" is unsupported

I am running docker-compose build in a folder with the relevant docker files and yml files. I see the following error

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/

The docker-compose.yml is as follows

# 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 version

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

docker version

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

I can't change the version on the docker-compose.yml file.

Upvotes: 27

Views: 40946

Answers (6)

Utopiah
Utopiah

Reputation: 324

Docker now officially supports compose so according to the documentation https://docs.docker.com/compose/install/compose-plugin/#install-using-the-repository use sudo apt-get install docker-compose-plugin then docker compose.

If you use sudo apt-get install docker-compose then docker-compose then you will end up with the older tool not supporting the newest format.

Upvotes: 1

Ahmed Adel Elfeky
Ahmed Adel Elfeky

Reputation: 81

The spec was updated in Compose v1.27 to merge the properties from version 2.x and 3.x compose files into a single format. The version property can still be included for legacy reasons but is no longer required and can be omitted if running the latest release of docker-compose.

The following script will update your installation on Ubuntu and solve the issue :

#!/bin/bash
sudo apt-get remove docker-compose 
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.1/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

Upvotes: 8

SFARPak
SFARPak

Reputation: 79

Using "sudo" the command works for me.

sudo docker-compose up

Upvotes: 1

S.Kihara
S.Kihara

Reputation: 191

I did the following steps:

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

I hope this will resolve this issue.

Upvotes: 0

KARTHIKEYAN.A
KARTHIKEYAN.A

Reputation: 20168

I have resolved the issue using following steps

$ 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

Upvotes: 23

atline
atline

Reputation: 31674

Your compose is too old, if you cannot change the version in compose, try to upgrade to latest docker-compose version

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

Detail refers to this

Upvotes: 18

Related Questions