Self Hosted Codespaces

Lukas Gentele
Rich Burroughs
6 min read

There’s been a lot of interest in dev containers since GitHub launched Codespaces in 2020. While Codespaces can be an excellent solution for some projects, it is a managed service, which can have some downsides. A big one is the cost. Not every team can afford to pay to run their dev containers using a managed service.

While it’s not possible to self-host Codespaces, as it’s not open source, you can get pretty close. In this post, we’ll look at DevPod, a new open source tool that lets you run your dev containers anywhere that you have infrastructure available. DevPod allows you to run dev containers using Docker on your laptop or remotely at your cloud provider. Wherever you choose to run your containers using DevPod, you only pay for the infrastructure you actually use, and DevPod manages the lifecyle of that infrastructure. 

#Why Dev Containers?

Managing development environments is very challenging. It’s an issue that every dev team needs to address to keep the team members productive and happy.

One big challenge is managing dependencies. This one is so big that most languages have built tools that allow people to use multiple versions of the languages and their dependencies on one computer (nvm, pyenv, rbenv, etc.). While these tools can be a big help, it can still be challenging to ensure everyone on the team uses the same version of every library. And some dev teams have to fight this battle across multiple languages.

Another big challenge is onboarding new members onto a dev team. For some teams, getting a new developer a working dev environment can take days or weeks, and the same goes for team members who get a new laptop. While Docker containers have helped a lot in simplifying things, they only solve some of the problems. Documentation can get stale if it’s not updated regularly, and people doing remote development may forget to clean up unused environments, which costs the company money.

DevPod addresses these problems by giving developers low-touch access to containerized dev environments. Everyone uses the same set of development and libraries, which are installed inside the container, and the configuration for the container is a JSON file that everyone on the team can consult to answer many of their own questions.

#Why DevPod?

DevPod is an open source, client only, unopinionated tool for running dev containers. Let’s take a look at each of those aspects of DevPod.

#Open source

We believe strongly in open source, and if you found this article while looking for a way to self-host Codespaces, you probably do too. Compared to a closed, managed solution, the massive benefit of open source is that there’s no lock-in. You can use DevPod with any infrastructure. And, of course, it’s free.

Also, DevPod utilizes the Development Containers standard that Microsoft invented for its tools like VS Code and Codespaces, which uses the devcontainer.json file. While Microsoft created the standard, it’s become an open standard supported by multiple vendors. This guarantees that DevPod will continue to be compatible with tools like VS Code, and if you ever decide that you’re done with DevPod, you can move to a new tool that also uses the Dev Containers standard without changing your code.

In fact, the quickstart examples we use with DevPod were all created by Microsoft to show off the Dev Container Standard. They work seamlessly with DevPod with no changes, directly from Microsoft’s GitHub repos.

DevPod’s Add Provider window

This is the power of open source and open standards.

#Client only

To use DevPod, you just install the DevPod app on your laptop or computer. That’s it. You don’t need to install anything else, even if you’re doing remote development. That means you won’t have to open a ticket for the DevOps or SRE team to run a new app on their servers. 

You install the code and all of the tools you need inside the dev container, and DevPod will work seamlessly with popular IDEs like VS Code (both the app and browser versions), IntelliJ, and Goland. And as more IDEs adopt the Dev Containers standard, they’ll work with DevPod too.

And while DevPod ships as an app for macOS, Linux, and Windows, there’s also a DevPod CLI for folks who prefer the command line.

#Unopinionated

This is one of the biggest differences between DevPod and a managed solution like Codespaces. DevPod is designed to be flexible and to meet developers where they’re at.

Does your team run your development app instances in the same cloud provider you use for production? You can do that with DevPod. Do you prefer to run the containers locally in Docker on your laptop for free? You can do that with DevPod, too. Do you have a specific app that has more significant hardware needs (like AI/ML workloads) that you need to run sometimes on a different instance type? You guessed it, that’s something DevPod can do.

In fact, with DevPod, you’re not locked into even always using one of those three scenarios. You can run a dev container on your cloud provider but then launch it in your local Docker Desktop environment when you hop on a long flight and want to work. You can run the container on one cloud instance type normally but throw it on a beefier one to run heavier integration tests.

DevPod uses the concept of providers, which you may know from tools like Terraform. Providers handle launching the dev containers and managing their lifecycles, so you don’t have to think about it, and there’s a provider for each place your infrastructure runs. DevPod ships with providers for using local Docker, Kubernetes, AWS, GCP, Azure, and more. And if there’s not a provider for the infrastructure you want to use, you can write one. Community members are also developing and sharing their providers, which is great to see.

The advantages of an open source, client only, and unopinionated tool like DevPod are significant compared to proprietary, managed solutions. But if you try DevPod and don’t like it, you can always switch back to Codespaces without changing the code in your projects. That’s the beauty of the open Dev Containers standard.

#More resources

We hope that you’re now excited to learn more about DevPod. Here are some great next steps:

  • Try the DevPod quickstart. It only takes a few minutes.
  • Visit the DevPod website for links to the docs and the GitHub repo.
  • Visit the #devpod channel in the Loft Community Slack, where the DevPod maintainers and many other users hang out. It’s a great place to ask questions and meet other folks in the DevPod community.

Sign up for our newsletter

Be the first to know about new features, announcements and industry insights.