skip to Main Content

I’m practicing with Docker but I have this message in my terminal. Someone have any solution?

my docker-compose

mongo:
  image: mongo
  ports: 
  - "27017:27017"
  restart: always

web:
  build: .
  ports: 
  - "3000:3000"
  links: 
  - mongo
  command: node index.js

Terminal:

(root) Additional property mongo is not allowed

2

Answers


  1. Chosen as BEST ANSWER

    Thanks, my problem was that web had the same level of services.

    version: "3"
    services:
      mongo:
        image: mongo
        ports: 
        - "27017:27017"
        restart: always
    
      web:
        build: .
        ports: 
        - "3000:3000"
        links: 
        - mongo
        command: node index.js
    
    

    Thanks for all.


  2. Missing the services keyword.

    version: "3.9"  # optional since v1.27.0
    services:
     mongo:
      image: mongo
      ports: 
      - "27017:27017"
      restart: always
     .....
    

    see the official doc

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search