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 →

Frustrated with Programming Language Version Managers? Ditch Them for Docker

blog/cards/frustrated-with-programming-language-version-managers-ditch-them-for-docker.jpg

Docker will easily let you run multiple versions of your favorite programming language. Eliminate tools like rvm, virtualenv, nvm and phpbrew.

Quick Jump: Just Let Me Write Code Already | Time to Update Your Language's Version | One of My Clients Wrote Millions of Lines of Code | Cool Story, but How Does Docker Fix Things?

I remember back in the day, when I first got introduced to Ruby on Rails. It was a very fun time… until it got to the point where I had to install Ruby.

If you’re not a Rails developer, that’s ok. You probably have your own set of issues with whatever tools your language has to help you install and separate different versions on your dev machine.

Getting Ruby installed in an isolated way is not an easy task, especially if you’re on Windows.

Every tutorial you read recommends a different way of installing Ruby. Are you supposed to use rvm, rbenv or chruby? Then on top of that, the tutorials you follow likely only cover installing everything on a Mac, because it’s not like people use Linux or Windows too right?

If you’re a beginner, this is a massive barrier of entry.

Just Let Me Write Code Already

All you want to do is start hacking away on your first web project with the shiny new web framework you’re dying to use after binge watching 30 Youtube videos on how awesome it is.

Unfortunately over the 20 years I’ve been actively learning and working as a software developer, I’ve heard countless stories about people giving up because it was just too hard to get started.

When I got started with Rails, I was already a seasoned developer, and even I found it really annoying to get a fully working development environment up and running. It eventually lead me down the path of using Virtual Machines (and years later, Docker), but that’s a story for another time.

Note: I’m one one of those die hard ultra hardcore determined people who will not stop until something works. If it means getting stuck for literally 17 hours straight, then I’ll somehow work through it but I can tell you one thing – those 17 hours are extremely unpleasant.

In the development world, I’m sure you’ve already realized that nothing is more infuriating than getting stuck on something for a long time, especially if no resolution is in sight.

Time to Update Your Language’s Version

So let’s say that you finally get beyond installing your language and framework of choice. Now you can start coding. Hopefully you didn’t have to spend more than a few grueling days getting everything up and running.

There’s going to come a point in your development life where you want to upgrade from XYZ language 1.0 to 1.1, or start a new app that uses a newer version of your favorite web framework.

One would think after spending all of that time setting up your development environment with a language version manager, it would be super easy to upgrade versions. Haha, maybe in another universe, but not ours.

In most languages you’ll end up getting dependency conflicts with the packages you use, especially if you plan to run 2 different versions of your favorite web framework with the same language version – which is a reasonable request to have if you live in the real world.

Now comes what I like to call the “bundler dance” (in the Ruby world), and this is where a previously working Gemfile from a project stops working after a minor language upgrade and you have to track down a million dependency mismatch errors until it works.

What you do to make it work will depend on what gems you’re installing, but usually it involves manually installing a certain package you depend on before you actually run bundle install.

Sadly, this dance may last for an entire day and it’s like clockwork. It happens every single time and things get amplified as you have more projects on your system to juggle.

One of My Clients Wrote Millions of Lines of Code

I remember being with one of my clients once. This is a guy with more Rails experience than me and he’s written millions of lines of code since the 80s. He’s seen it all and has been working with Rails since nearly version 1.0 (~2005).

His machine has dozens of projects, some of which have 100k+ lines of code, and they are all sprawled across multiple versions of Ruby AND Rails.

It took him around 3 days just to get a new non-trivial project running because of gem conflicts. Of course, it also meant some of his other applications stopped working too.

Then he decided to upgrade his laptop after 5 years, and getting everything working there was an insurmountable task, even for him. Nothing worked anymore and it was a nightmare just to get anything into a near working state.

That type of environment is unacceptable to be working with.

Needless to say he was a happy camper after I got him situated with Docker.

Cool Story, but How Does Docker Fix Things?

What if I told you that you can install Docker in about 5 minutes and then if you wanted to use any version of any programing language, all you have to do is edit 1 line in 1 file and run a command?

Here, let me show you how you could use Ruby 2.3 with Docker:

FROM ruby:2.3

Oh, you want to upgrade to 2.4, or maybe your next app will use 2.4 instead?

FROM ruby:2.4

That’s all there is to it. If you don’t use Ruby, that’s fine. Docker has official support for nearly every language and the process to change versions is the same (which in itself, is a huge win).

You can also have 1 or 100 different versions of your favorite programming language installed at the same time and never have to deal with a version conflict again.

All of your projects will be in total isolation, and if they worked 2 years ago they will work today. Even if you added new projects that have different versions and dependencies.

When was the last time you got burnt by your language’s version manager?

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.



Comments