Getting a ¨docker-compose.yaml¨ is invalid error

I am trying to setup NextCloud with Docker-compose and I have prepared the following docker-compose.yaml file:

version: '2'

volumes:
  nextcloud:
  db:

services:
  db:
    image: postgres
    restart: unless-stopped
#    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - db:/media/nextcloud/postgres
    environment:
      - POSTGRES_PASSWORD=securepassword
      - POSTGRES_DB=nextcloud
      - POSTGRES_USER=nextcloud

  app:
    image: nextcloud
    restart: unless-stopped
    ports:
      - 6677:80
    links:
      - db
    volumes:
      - nextcloud:/media/nextcloud/html
      - apps:/media/nextcloud/apps
      - config:/media/nextcloud/config
      - data:/media/nextcloud/userdata
      - theme:/media/nextcloud/theme
    environment:
      - POSTGRES_PASSWORD=securepassword
      - POSTGRES_DB=nextcloud
      - POSTGRES_USER=nextcloud
      - POSTGRES_HOST=db
      - NEXTCLOUD_DATA_DIR=/media/nextcloud/usersdata
      - NEXTCLOUD_TRUSTED_DOMAINS=nextcloud.domain.com
      - NEXTCLOUD_ADMIN_USER=admin
      - NEXTCLOUD_ADMIN_PASSWORD=securepassword

when I use docker-compose up -d i face an error:

The Compose file './docker-compose.yaml' is invalid because:
services.app.environment contains non-unique items, please remove duplicates from ['MYSQL_PASSWORD=securepassword', 'MYSQL_DATABASE=nextcloud', 'MYSQL_USER=nextcloud', 'MYSQL_HOST=db', 'NEXTCLOUD_DATA_DIR=/media/nextcloud/usersdata', 'NEXTCLOUD_TRUSTED_DOMAINS=nextcloud.domain.com', 'NEXTCLOUD_ADMIN_USER=admin', 'NEXTCLOUD_ADMIN_PASSWORD=securepassword']

I dont really understand where the duplicates in my file.

Anyone has an idea where i went wrong ?

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Run docker-compose up -d on the docker-compose.yaml file