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

Here is the docker-compose.yml

version: “2”
services:
  web:
   build: .
   environment:
    MONGO_URI="mongodb://ravimongo:27017"
   ports:
    — “3000:3000”
   links:
    — ravimongo
   depends_on:
    — ravimongo
  ravimongo:
   image: mongo:3.2.6
   ports:
     — “27017:27017”

Here is the error:

  • Unable to push docker image on local private registry
  • SQL Server on Linux > Bulk Import error
  • How to start docker daemon automatically with custom arguments in Ubuntu?
  • Docker and gulp
  • psql: could not translate host name “somePostgres” to address: Name or service not known
  • Passing parameter in docker build command with fish
  • 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 ("2.0", "2.1", "3.0") 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/
    

    Version details are as follows:
    docker-compose version

    docker-compose version 1.11.2, build dfed245
    docker-py version: 2.1.0
    CPython version: 2.7.12
    OpenSSL version: OpenSSL 1.0.2j  26 Sep 2016
    

    docker version

    Client:
     Version:      17.03.1-ce
     API version:  1.27
     Go version:   go1.7.5
     Git commit:   c6d412e
     Built:        Tue Mar 28 00:40:02 2017
     OS/Arch:      darwin/amd64
    
    Server:
     Version:      17.03.1-ce
     API version:  1.27 (minimum version 1.12)
     Go version:   go1.7.5
     Git commit:   c6d412e
     Built:        Fri Mar 24 00:00:50 2017
     OS/Arch:      linux/amd64
     Experimental: true
    

    I verified the yaml syntax in http://www.yamllint.com/ and https://codebeautify.org/yaml-validator. I am unable to find the problem.

  • Why does apt-get exit without an error during Dockerfile build?
  • docker-compose volumes not mounting to host directories
  • Starting new Docker container with every new Bamboo build run and using the container to run the build in
  • Requirement to accept network packets in container from host or outside? (docker port forwarding)
  • Connect docker container
  • How to persist Rancher server meta data
  • 3 Solutions collect form web for “ERROR: Version in “./docker-compose.yml” is unsupported. You might be seeing this error because you're using the wrong Compose file version”

    The YAML is valid. However, you are using a left double quotation mark like so:

    version: “2”

    Based on the error, seems like Docker Compose is not able to parse the version correctly. If you use a left double quotation mark instead of a quotation mark, the version which will be picked up by Docker compose will be “2” and not 2, and hence it shall not be able to equate it to the supported versions ("2.0", "2.1", "3.0"). I would suggest changing it to the following:

    version: "2"

    Let me know if the errors still persist.

    As stated in the error logs you should replace it by “2.0” instead of simply “2”.

    Your editor is injecting smart-quotes instead of normal ascii quotes here:

    version: “2”
    

    that needs to be:

    version: "2"
    

    I’d recommend not writing yml files with that editor to avoid issues in the future.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.