Docker Tip #41: Should You Use Virtualenv / RVM in Your Docker Images?
Before Docker, it was common to use Virtualenv, RVM and other runtime versioning tools. Do we need them inside of Docker images?
Docker’s main purposes are to provide process isolation and to pack up your applications into individual self contained images.
Prior to using Docker, you would likely reach for tools like Virtualenv (Python) and RVM / chruby (Ruby) to deal with the complexity of running multiple versions of Python and Ruby on your system.
On our development machines and in production, we certainly no longer need to use those tools directly on our systems because project isolation is provided by Docker.
But what about inside our Docker images, are there any advantages to setting up versioning tools for your favorite language?
I think not. If you stick to the best practice of running 1 application per container, then only 1 app will be running at a time per container, in which case you can use the language version directly installed in the Docker image.
Since each app has its own process / self contained Docker image, it would be redundant to use a version management tool inside of the Docker image itself.