Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

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.

Free Intro to Docker Email Course

Over 5 days you'll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you'll have hands on experience using Docker to serve a website.