Why and how you should dockerize your development environment (with VS Code 💙)

mehdio
6 min readJan 18, 2021

In this blog post, I will cover a few elements that should motivate you to dockerize your development environment and give you a repo example on how you can smoothly achieve this with VS Code. The idea here goes further than just "I have my application dockerized that I can test locally," and creates a complete development experience entirely (or almost?) in docker. I will also share my general experience, and limits I have encountered while having all my development environment dockerized for the past few months.

So… Why?

It uses the same runtime environment as your application

  • A good practice nowadays is to provide a Dockerfile for either the target deployment runtime (e.g K8s, AWS Fargate, GCP Cloud Run, etc…) or local testing. It's relatively easy to extend this existing image for development purposes.
  • Managing multiple versions of multiple frameworks/languages is easier. Even if there are tools to help to solve this (for example python version and pyenv) it's easier if it's just a variable to change in your Dockerfile, and no conflicts guarantee.
  • No more "it works on my machine". It will work on your machine, and everywhere docker is too. (*)

(*) Actually, you may have little glitches between Windows and Unix host (for path references for example).

Standardize development tools

Every developer has their own flavors of IDE/extensions/terminal and I'm not fighting against that. But because docker provides you with a base layer, you can also add all the classic things a developer may need along the way and share best practices for the sake of productivity. Plus, when using VS Code, you can configure extensions to be installed for that environment.

Aside from this, any developer can still override these base settings with their custom choices.

Get Ready for Cloud IDE

There are a couple of initiatives for some years now to provide a Cloud IDE experience (Cloud9, Codeanywhere, etc), and to be honest, I've tried them regularly but wasn’t really satisfied with the…