You can build a container with Dockerfile
in a few seconds.
Then why do people need to install a virtual enviroment inside the docker container?
It’s like a “virtual machine” in a virtual machine ?
Advertisement
Answer
I am working with virtualenvs in Docker and I think there are several reasons:
- you may want to isolate your app from system’s python packages
- you may want to run a custom version of python but still keep the system’s packages untouched
- you may need fine grain control on the packages installed for a specific app
- you may need to run multiple apps with different requirements
I think these are all reasonably good reasons to add a little pip install virtualenv
at the end of the installation! :)