3

I'm trying to build a django project using docker-compose, such as it is in the Docker Documentation (i use Docker toolbox for Windows 10 Home).

But when i execute the command:

sudo docker-compose run web django-admin startproject composeexample .

I get an bash: sudo: command not found

enter image description here


Then if i execute the same command without "sudo":

docker-compose run web django-admin startproject composeexample .

The image is created but the django project folder is not displayed:

ls command doesn´t show the django project

Finally, when i run the command again i get:

The project already exists

Indicating that the project was created in the previous step.


The Dockerfile is:

FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/

docker-compose.yml

version: '3'
services:
  db:
    image: postgres
  web:
    build: .
    command: python manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/code
    ports:
      - "8000:8000"
    depends_on:
      - db

and the requirements.txt:

Django>=2.0,<3.0
psycopg2>=2.7,<3.0
Endy Bermúdez R
  • 351
  • 1
  • 2
  • 8
  • Same issue, did you ever figure it out? – seth Oct 16 '20 at 21:35
  • Figured this out and answered it here: https://stackoverflow.com/a/64396873/292633 – seth Oct 17 '20 at 16:14
  • Does this answer your question? [no django app created when following the docker-compose tutorial](https://stackoverflow.com/questions/31565640/no-django-app-created-when-following-the-docker-compose-tutorial) – seth Oct 17 '20 at 16:15

0 Answers0