Search code examples
docker-compose

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.1'

services:
  a:
    image: tutum/hello-world
  b:
    image: tutum/hello-world

secrets:
  id: my_password

If I run $ docker-compose-up I get this:

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

My docker-compose version:

$ docker-compose --version
docker-compose version 1.11.0, build 6de1806

What's wrong here? Shouldn't my docker-compose version support v3.1 of the docker-compose.yml specification (according to the release notes, it does) ?


Solution

  • You are doing everything right and it should work. But there was a bug in docker-compose 1.11.0 which not recognized file format 3.1 as valid. (3.0 works).

    There is already a new release of docker-compose (1.11.1) which includes the bugfix:

    Bugfixes

    Fixed a bug where the 3.1 file format was not being recognized as valid by the Compose parser

    So I would recommend to upgrade your docker-compose version if you want to use file format 3.1.

    At the moment the safest way to upgrade docker-compose is by deleting it and reinstalling it.

    rm /usr/local/bin/docker-compose
    

    Reinstall:

    curl -L https://github.com/docker/compose/releases/download/1.11.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
    chmod +x /usr/local/bin/docker-compose
    docker-compose --version
    docker-compose version 1.11.1, build 7c5d5e4
    

    Now there isn't an error anymore on the file format. (I did not test with your .yml).

    docker-compose up
    Starting compose_a_1
    Starting compose_b_1