Did you know that you don’t have to setup a complete development environment anymore?
The first step to this process was the ability of IDEs to natively interact with Docker containers. Being able to deploy and debug our developer code within a container created a way to test code that is isolated from the development environment. It was a great first step, but as developers, we often strive for better than great 🤗
The real problem for developers is setting up the development environment. Correctly configuring a developer environment can take anywhere from minutes to days, depending on the complexity. We need plugins, personal configurations, and the app-specific needs. Then we need to setup the environment for testing and debugging. This can include queues, databases, file services, and more. The solution? Separate the heart of the IDE from the UI, enabling it to run headless in a container. Out of this simple innovation came Dev Containers.
A Development Container is an infrastructure-as-code solution that defines a complete development environment. The entire development environment is repeatable, reproducible, and version-controlled. An IDE can create an instance of a Development Container and connect to it. Within the container, a complete, stand-alone environment configuration can be defined and deployed. Because these environments are distributed as code, it’s easy for a team to get started developing. There’s a few ways to take advantage of this:
If you’re running a local VS Code environment, learn to create a Dev Container. This allows you to create a complete environment in code and develop locally using Docker.
If you have a GitHub Team or Enterprise account, consider setting up Codespaces. This adds on to the VS Code approach, enabling you to run the environment entirely from within a remote browser. Believe it or not, the GitHub team develops on CodeSpaces. At its most basic, this is essentially the cloud-hosted version of a VS Code Dev Container. It adds some additional features, such as using a dotfiles repository to personalize the container with your favorite settings.
Needing to host internally on a Kubernetes cluster? Gitpod offers a competing solution. In addition to supporting the VS Code server, it also supports the Jetbrains Projector. They offer a cloud-hosted environment as well. The source code is available on GitHub.
More options are undoubtedly on the way. At the moment, these solutions don’t work for Visual Studio. For now, those users will need to settle for just deploying and debugging containers. I suspect that may change in the future.
And for what it’s worth … this blog is developed in a container. 😎