Search code examples
djangodockerpip

Docker permissions issue on Fedora 36


I am following a Docker / Django tutorial on Fedora 36. I am getting an error with RUN pip install -r requirements.txt . from within the Dockerfile. The error is: The command '/bin/sh -c pip install -r requirements.txt .' returned a non-zero code: 1 exec /bin/sh: permission denied Here is my docker file:

#Pull base image
FROM python:3.10.4-slim-bullseye
#Set enviornment variables
ENV PIP-DISABLE_PIPVERSION_CHECK 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

#Set work directory
WORKDIR /code

#Install dependencies
COPY ./requirements.txt .
RUN pip install -r requirements.txt

#Copy project
COPY . .

Here is the requirements.txt file:

asgiref==3.5.2
#backports.zoneinfo==0.2.1
Django==4.0.5
sqlparse==0.4.2

Solution

  • Docker quit working correctly after the Fedora 36 upgrade. My solution was to completely uninstall Docker and reinstall it per instructions at: https://docs.docker.com/engine/install/fedora/

    Uninstall old versions:

    sudo dnf remove docker \
                      docker-client \
                      docker-client-latest \
                      docker-common \
                      docker-latest \
                      docker-latest-logrotate \
                      docker-logrotate \
                      docker-selinux \
                      docker-engine-selinux \
                      docker-engine
    

    Set up the repository

    sudo dnf -y install dnf-plugins-core    
    sudo dnf config-manager \
        --add-repo \
        https://download.docker.com/linux/fedora/docker-ce.repo
    

    Install the Docker Engine

    sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin
    

    Start Docker

    sudo systemctl start docker
    

    This fixed it for me.