Issue
For development we use virtualenv to have an isolated development when it comes to dependencies. From href="https://stackoverflow.com/questions/9337149/is-virtualenv-recommended-for-django-production-server">this question it seems deploying Python applications in a virtualenv is recommended.
Now we're starting to use docker for deployment. This provides a more isolated environment so I'm questioning the use of virtualenv inside a docker container. In the case of a single application I do not think virtualenv has a purpose as docker already provides isolation. In the case where multiple applications are deployed on a single docker container, I do think virtualenv has a purpose as the applications can have conflicting dependencies.
Should virtualenv be used when a single application is deployed in a docker container?
Should docker contain multiple applications or only one application per container?
If so, should virtualenv be used when deploying a container with multiple applications?
Solution
Virtualenv was created long before docker. Today, I lean towards docker instead of virtualenv for these reasons:
- Virtualenv still means people consuming your product need to download eggs. With docker, they get something which is "known to work". No strings attached.
- Docker can do much more than virtualenv (like create a clean environment when you have products that need different Python versions).
The main drawback for Docker was the poor Windows support. That changed with the version for Windows 10.
As for "how many apps per container", the usual policy is 1.
Answered By - Aaron Digulla Answer Checked By - Cary Denson (WPSolving Admin)