What is the purpose of running a django application in virtualenv inside a docker container?

What is the purpose of virtualenv inside dockang docker application? Python and other dependencies are already installed, but at the same time you need to install many packages using pip, so it seems that the conflict is still unclear.

Could you explain the concept?

EDIT: Also for example. I created virtualenv inside the docker docker application and recently installed pip freeze djangorestframeworkand added it to the one installed in settings.py, but it docker-compose upraises the error . No module named rest_framework.Checked, is everything .docker / virtual conflict correct ? May be?

+4
source share
2 answers

, . distutil Glpyh pycon.

virtualenv , , Linux.

Debian Red Hat . C. , apt install libavcodec. yum install ffmpeg.

. Python . , Python .

, , docker , Python, sudo pip install , .

, , .

, virtualenv, , . RUN , , , . virutalenv, :

RUN apt-get install -y python-virtualenv
RUN virtualenv /appenv
RUN . /appenv/bin/activate; \
    pip install -r requirements.txt

ENTRYPOINT . /appenv/bin/activate; \
           run-the-app
+7

. Docker . , , , virtualenv.

, . , docker, .

.

FROM /path/to/used/docker/image
RUN pip install -r requirements.txt
+3

Source: https://habr.com/ru/post/1670827/


All Articles