Amir
Amir

Reputation: 340

Version in “./docker-compose.yml” is unsupported. You might be seeing this error because you're using the wrong Compose file version

Here's my docker-compose.yml file:

version: '3.7'
services:

  database:
    image: mongo:3.6
    restart: always
    environment:
      - MONGO_INITDB_ROOT_USERNAME=root
      - MONGO_INITDB_ROOT_PASSWORD= 123456
    container_name: mongo-01-database-container
networks:
  database-01:
    name: database-01-network
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 172.24.0.0/16
docker --version 
Docker version 18.09.2, build 6247962
docker-compose --version 
docker-compose version 1.18.0, build 8dd22a9

What's wrong here? Shouldn't my docker-compose version support v3.1 of the docker-compose.yml specification?

Upvotes: 0

Views: 1755

Answers (2)

Prashanth Sams
Prashanth Sams

Reputation: 21169

Checkout the docker-compose Compatibility matrix here:

https://docs.docker.com/compose/compose-file/compose-versioning/

enter image description here

Upvotes: 2

Gino Mempin
Gino Mempin

Reputation: 29711

You need to check the compatibility between the version: 'X' value you put on your docker-compose.yml file and your docker-compose version.

You have docker-compose 1.18.0, which only supports up to version 3.3-3.5 of the docker-compose.yml specification. Support for version: '3.7' was only introduced starting at docker-compose 1.22.0:

Compose format version 3.7

Introduced version 3.7 of the docker-compose.yml specification.
This version requires Docker Engine 18.06.0 or above.

You need to update your docker-compose to 1.22+.

Upvotes: 1

Related Questions