Why is my docker composer volume not work?



  • My volume isn't being created with the containers, this volume binds with the host, every time I try to attempt to run it or go to an online validator for yaml, it shows up correct validation on the validator but fails to run.

    ERROR: In file './docker-compose.yaml', service 'image' must be a mapping not a string.

    and I can't understand what's causing this when the online validator says it's a valid yaml.

    version: "3.7"
    services:
     image:  postgres
     environment:
       - POSTGRES_DB=postgres
       - POSTGRES_USER=postgres
       - POSTGRES_PASSWORD=postgres
    

    build: .
    command: python manage.py runserver 0.0.0.0:8000
    volumes:

    • .:/app
      ports:
    • "8000:8000"
      depends_on:
    • db


  • version: "3.7"
    services:
      CONTAINER_NAME:
       image:  postgres
       environment:
         - POSTGRES_DB=postgres
         - POSTGRES_USER=postgres
         - POSTGRES_PASSWORD=postgres
    
       build: .
       command: python manage.py runserver 0.0.0.0:8000
       volumes:
         - .:/app
       ports:
         - "8000:8000"
       depends_on:
         - db
    

    source : https://stackoverflow.com/questions/56733841/service-image-must-be-a-mapping-not-a-string


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2