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:

  • Failed to find a usable hardware address from the network interfaces
  • Use the result of RUN to set a variable
  • Bitbucket Pipeline how to setup ssh agent to deploy on a remote server
  • Dockerfile necessary? Advisable?
  • Using Docker with nodejs with node-gyp dependencies
  • Graceful Shutdown of HDFS with Docker
  • 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

  • mkdir .ssh in a Dockerfile, folder is not there?
  • Docker Access to Raspberry Pi GPIO Pins
  • Does data needs to have a specific format to upload it in Docker?
  • dockerfile is not creating directory and copying files?
  • How to use Moby to create a custom made container system?
  • How to monitor docker daemon pull progress
  • 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.