docker-compose : Unsupported config option for services service: 'web'

I am going through getting started page for docker-compose:
https://docs.docker.com/compose/gettingstarted/

In Step 3, I made a docker-compose.yml file as described:

  • ps --filter does not work with -H
  • Docker volume mounts with template strings in Docker Compose
  • terminal list the files but not visible in file browser - NFS
  • What does virtual size of docker image mean?
  • Jenkins and docker-compose
  • local files missing from docker-machine container
  • version: '2'
    services:
        web:
            build: .
            ports: 
                - "5000:5000"
            volumes: 
                - .:/code
            depends_on:
                - redis
        redis:
            image: redis
    

    But when I run:

    $ docker-compose up
    

    I get following error:

    Unsupported config option for services service: ‘web’

    I am not able to figure out what is going on. Any help?

    Thank you

  • Docker private repo with multiple images
  • Installing new gentoo kernel in docker container
  • Is Postgres designed to write to shared data stores?
  • Multiple Websites and PHP Versions with Docker-Compose
  • How to expose docker container's ip and port to outside docker host without port mapping?
  • unable to run Apache/php from docker container
  • One Solution collect form web for “docker-compose : Unsupported config option for services service: 'web'”

    Support for the version 2 compose file format was introduced in docker-compose version 1.6, released around February of this year.

    You’re using 1.3.3, from July 2015.

    You need to upgrade to a more recent version to use the version 2 format configuration files.

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