Getting the error as ERROR: The Compose file './docker-compose.yml' is invalid because: Unsupported config option for services: 'db' while composing

docker-compose.yml

services:
  db:
    image: postgres
    environment: 
      - POSTGRES_PASSWORD=mydbsecretpassword
  wordpress: 
    image: wordpress
    ports: 
      - "8085:80"

While composing the file I am getting the error:
ERROR: The Compose file './docker-compose.yml' is invalid because: Unsupported config option for services: 'db'

Docker version is 18.09.5

Docker compose version is 1.17.1