You can build a container with Dockerfile in a few seconds, then why people needs to install a virtual enviroment inside the docker container?
It's like a "virtual machine" in a virtual machine ?
You can build a container with Dockerfile in a few seconds, then why people needs to install a virtual enviroment inside the docker container?
It's like a "virtual machine" in a virtual machine ?
Here is my two cents, or rather comments on @gru 's answer and some of the comments.
So in conclusion: There is no good reason for using a virtual environment inside a container. Install whatever packages you need on the system. If you need control over the exact package versions, install the (docker-wide) with
pip
or alike.If you think that you need to run different apps with different package versions inside a single container, take a step back and rethink your design. You are heading towards more complexity, more difficult maintenance and more headache. Split the work/services up into several containers.
I am working with virtualenvs in Docker and I think there are several reasons:
I think these are all reasonably good reasons to add a little
pip install virtualenv
at the end of the installation! :)