简体   繁体   中英

I'm running docker-compose up, terminal show me: (root) Additional property mongo is not allowed

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM