I am new in Docker and learning it, and my question is that do I have to use venv in Docker or isn't it important? Because I couldn't configure venv in docker, it gives me an error like cannot import Django activate venv..., I read some answers but couldn't get answer, some people say need to use venv others not important.
My DOckerfile
FROM python:3.8
#set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN python3 -m venv venv
#Set work directory
WORKDIR /code/
#Install dependencies
COPY requirements.txt .
RUN . /venv/bin/activate && pip install -r requirements.txt
COPY . /code/
If I don't use venv Docker runs fine, but when it comes to install package it gives me warning like WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead:...
Can someone explain clearly it?
Thanks in advance