Top level object in './docker-compose.yml' needs to be an object not '<class 'NoneType'>'
Asked Answered
C

6

27

I'm using python 3.8, Docker version 19.03.13, build 4484c46d9d 3.8

version: '3.8'
services:
  web:
    build: .
    command: python /code/manage.py runserver 0.0.0.0:8000
  volumes:
    - .:/code
  ports:
    - 8000:8000
Countershading answered 23/10, 2020 at 15:3 Comment(3)
what does your docker-compose.yml looks like?Blakeney
your docker-compose.yml seems to have indent problems. I've edited your question and fix it! use the version I've edited and post the resultsBalenciaga
thanks the error was in docker-compose.ymlCountershading
P
64

Maybe docker-compose.yml is empty

Premer answered 10/11, 2020 at 7:13 Comment(3)
In my case it was docker-compose.override.yml that was emptyLinesman
Save file and try againMady
This was my case. I never saved the file after adding my changes.Varicelloid
C
20

Your .yml file must be empty. Try saving the file.

Carrageen answered 14/1, 2021 at 8:34 Comment(1)
I feel so embarrassed when this kind of thing happens lol Thank you!Electroplate
P
8

If you have just created your docker-compose.yml chances are you haven't saved it and hit docker-compose up.

Save it and try again. It should work fine

Pinette answered 16/9, 2021 at 11:13 Comment(0)
M
0

In case of docker-compose.dcproj project check for all the .yml files and nothing should be empty.

  1. docker-compose.override.yml
  2. docker-compose.yml
Macadamia answered 20/5, 2021 at 7:26 Comment(0)
T
0

create file docker-compose.yaml that looks like the below picture and it started working docker.compose.yaml

Trinidad answered 9/11, 2021 at 11:22 Comment(0)
P
0

Hit this because I did

docker-compose --file .config/.env.dev up

Instead of

docker-compose --env-file .config/.env.dev up
Predicament answered 6/9, 2023 at 16:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.