Ali Rahmani
Ali Rahmani

Reputation: 81

what is volume 'type' error in docker-compos

im new in docker and docker-compos. this is my Docker and its created successfully.

FROM python:3.8-buster
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE 1
COPY . .
ARG name
RUN apt-get update
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt


docker-compose.yml :

version: "3.7"

services:
  django_web:
    build: .
    command: >
      apt -c "python3 manage.py makemigrations && python3 manage.py migrate && gunicorn mlAmeri.wsgi:application --bind 0.0.0.0:8000"
    volumes:
      - static: /app/staitc
      - media: /app/media
      - .: /app

    ports:
      - 8010:8000

  nginx:
    build: ./nginx
    volumes:
      - static:/app/static
      - media:/app/media
      - ./nginx/config/:/etc/nginx/conf.d/
    ports:
      - 8000:80
    depends_on:
      - django_web


volumes:
#  postgres_data:
  static:
  media:

and this my error

services.django_web.volumes 'type' is a required property

what's meaning of type ? what i miss?

Upvotes: 1

Views: 1710

Answers (1)

Gaël J
Gaël J

Reputation: 15275

You are just missing some quotes I believe:

volumes:
  - "static:/app/staitc"
  - "media:/app/media"
  - ".:/app"

See the documentation: https://github.com/docker/compose/blob/v1/docs/Compose%20file%20reference%20(legacy)/version-3.md

Edit: note that it's not a good practice to mount the entire current folder into the container though. You will be leaking unnecessary stuff in the container.

Upvotes: 2

Related Questions