[Python] Getting this Error PermissionError: [Errno 13] Permission denied: '/app/manage.py' in...

Discussão em 'Python' iniciado por Stack, Julho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I am encountering a PermissionError when trying to run the docker compose run command for creating a Django project. The error message is as follows :-

    docker compose run --rm app sh -c "django-admin startproject myproject ."
    [+] Building 0.0s (0/0) docker:desktop-linux
    [+] Building 0.0s (0/0) docker:desktop-linux
    Traceback (most recent call last):
    File "/py/bin/django-admin", line 8, in <module>
    sys.exit(execute_from_command_line())
    File "/py/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
    File "/py/lib/python3.9/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/py/lib/python3.9/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
    File "/py/lib/python3.9/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
    File "/py/lib/python3.9/site-packages/django/core/management/commands/startproject.py", line 21, in handle
    super().handle("project", project_name, target, **options)
    File "/py/lib/python3.9/site-packages/django/core/management/templates.py", line 205, in handle
    with open(new_path, "w", encoding="utf-8") as new_file:
    PermissionError: [Errno 13] Permission denied: '/app/manage.py'
    .
    .
    .



    And this is my Dockerfile :-

    FROM python:3.9-slim

    ENV PYTHONUNBUFFERED 1

    COPY ./requirements.txt /requirements.txt

    COPY ./app /app

    WORKDIR /app

    EXPOSE 8000

    RUN python -m venv /py && \
    /py/bin/pip install --upgrade pip && \
    /py/bin/pip install -r /requirements.txt && \
    adduser --disabled-password --no-create-home app



    ENV PATH="/py/bin:$PATH"

    USER app





    . .

    and this is my docker-compose.yml file :-

    services:
    app:
    build:
    context: .
    image: my-django-image
    ports:
    - 8000:8000
    volumes:
    - ./app:/app
    command: >




    i tried few of the solutions but nothing worked.. I'm using Zorin OS

    Continue reading...

Compartilhe esta Página