简体   繁体   中英

docker-compose up throwing error ERROR: In file './docker-compose.yml', service must be a mapping, not a NoneType

version: '3'
services :
web :

  build:
  ports:
  - "5000:5000"
  redis:
  image:"redis:alpine"

when executing the docker-compose up it throws an error: ERROR: In file './docker-compose.yml', service must be a mapping, not a NoneType

This happens because you put web: on the same level as services: . It needs to be more indented. Also, redis: needs to be on the same level as web: and you need a space after image: .

version: '3'
services:
  web:
    build:
    ports:
    - "5000:5000"
  redis:
    image: "redis:alpine"

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