Ao executar o comando docker compose build estou recebendo o seguinte erro:
ERROR: The Compose file './docker-compose.yml' is invalid because:
Invalid top-level property "mongodb". Valid top-level sections for this Compose file are: version, services, networks, volumes, secrets, configs, and extensions starting with "x-".
You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
Segue abaixo o conteúdo do meu docker-compose.yml:
version: '3' services: nginx: build: dockerfile: ./docker/nginx.dockerfile context: . image: douglasq/nginx container_name: nginx ports:
- "80:80"
networks:
- production-network
depends_on:
- "node1"
- "node2"
- "node3"
mongodb: image: mongo networks:
- production-network
node1: build: dockerfile: ./docker/alura-books.dockerfile context: . image: douglasq/alura-books container_name: alura-books-1 ports:
- "3000"
networks:
- production-network
depends_on:
- "mongodb"
node2: build: dockerfile: ./docker/alura-books.dockerfile context: . image: douglasq/alura-books container_name: alura-books-2 ports:
- "3000"
networks:
- production-network
depends_on:
- "mongodb"
node3: build: dockerfile: ./docker/alura-books.dockerfile context: . image: douglasq/alura-books container_name: alura-books-3 ports:
- "3000"
networks:
- production-network
depends_on:
- "mongodb"
Segue abaixo a minha versão do docker-compose:
docker-compose version 1.27.4, build 40524192
Segue abaixo a minha versão do Docker
Client: Docker Engine - Community Version: 19.03.8 API version: 1.40 Go version: go1.12.17 Git commit: afacb8b7f0 Built: Wed Mar 11 01:25:46 2020 OS/Arch: linux/amd64 Experimental: false
Server: Docker Engine - Community Engine: Version: 19.03.8 API version: 1.40 (minimum version 1.12) Go version: go1.12.17 Git commit: afacb8b7f0 Built: Wed Mar 11 01:24:19 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683**