Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Compose file is invalid, additional properties not allowed

This is my sample docker-compose.yml file.

version: '2'
config-server:
  image: ccc/config-server
  restart: always
registration-server:
  image: ccc/registration-server
  restart: always
  ports:
    - 1111:1111

When I use docker-compose up -d I get an error:

"ERROR: The Compose file './docker-compose.yml' is invalid because:
Additional properties are not allowed ('registration-server', 'config-server' were unexpected)

You might be seeing this error because you're using the wrong Compose file version. Either specify a version of "2" (or "2.0") 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.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/
like image 297
Chintamani Avatar asked Aug 02 '16 09:08

Chintamani


1 Answers

You are missing a services keyword, your correct .yml is:

version: '2'
services:
  config-server:
    image: ccc/config-server
    restart: always
  registration-server:
    image: ccc/registration-server
    restart: always
    ports:
      - 1111:1111
like image 111
michael_bitard Avatar answered Sep 16 '22 18:09

michael_bitard