Gavrilo Adamovic
Gavrilo Adamovic

Reputation: 2795

docker - compose error

This is my docker-compose.yaml

version: '2'
services:
  databases:
   image: mysql
   ports:
   - "3306:3306"
   environment:
   - MYSQL_ROOT_PASSWORD=password
   - MYSQL_USER=user
   - MYSQL_PASSWORD=password
   - MYSQL_DATABASE=demodb
web:
   image: nginx

Error: The Compose file ./docker-compose.yml' is invalid because: Additional properties are not allowed('web' was unexpected)

And on the bottom part it says that this is maybe because of the docker-compose version, but on docker website it says that docker on windows come with docker-compose and don't need to be installed separately.

Upvotes: 0

Views: 465

Answers (1)

sayboras
sayboras

Reputation: 5165

Issue is your indentation for web, please align it with the same level as databases service as per below. Then I manage to run docker-compose up

version: '2'
services:
   databases:
     image: mysql
     ports:
       - "3306:3306"
     environment:
       - MYSQL_ROOT_PASSWORD=password
       - MYSQL_USER=user
       - MYSQL_PASSWORD=password
       - MYSQL_DATABASE=demodb
   web:
     image: nginx

Upvotes: 1

Related Questions