Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When running "docker-compose up" I get the following message "services must be a mapping"

docker-compose.yml contains:

version: "3.9"
services:
build: .
web:
ports:
  - "8000:8000"
command: python manage.py runserver 0.0.0.0:8000
volumes:
  - .:/code
like image 946
EcDhyne Avatar asked Oct 24 '25 02:10

EcDhyne


1 Answers

It looks like everything after service: should be indented. Also, the service name should be before the build: . instruction. And it is best practice to use an array for the command when spaces are involved.

Try

version: "3.9"
services:
  web:
    build: .
    ports:
      - "8000:8000"
    command: ["python", "manage.py", "runserver", "0.0.0.0:8000"]
    volumes:
      - .:/code
like image 94
Julien B. Avatar answered Oct 26 '25 16:10

Julien B.