Unboxing Devcontainers and Docker

By Rachael Wright-Munn

Elevator Pitch

Rails 7.2 added devcontainers which enable a local developer experience with Docker’s portability, but adoption is slow: Docker, Docker Compose, and devcontainers are confusing. We’ll unbox them and explain best practices from open-source Rails projects that use these tools to onboard contributors.

Description

Rails introduced a default devcontainer setup in 7.2, but adoption has been slow because Docker, Docker Compose, and devcontainers can be confusing, and the full benefits aren’t widely understood. Devcontainers provide the developer experience of working locally with the consistency and portability of Docker, perfect for enabling open-source contributors to work on your project, no matter their operating system, development setup, or even in the cloud!

In this talk, we’ll unbox Docker images, Docker Compose, and devcontainers and show how they work together to create consistent, reliable Rails development environments. We’ll explain the reasoning behind best practices for configuring your devcontainer using real-world examples from Rails, RubyEvents, and Lobsters.

By the end, you’ll know how to use devcontainers to make onboarding new team members and open-source contributors fast, reliable, and frictionless!

Notes

I’ve built the devcontainer setup for my own projects, RubyEvents, and Lobsters. As an avid open-source contributor, I need to be able to drop into a project, make some changes, and throw away the dev environment in a month or two. Also, if I hop in, work on a project, drop it, and then decide to pick it up again in two years, I don’t want to fight with upgrading my old setup for the new one. With devcontainers, I can just toss the old one and regenerate. I also like how devcontainers will setup a dev environment for you in GitHub codespaces, enabling you to contribute without setting up anything locally.

As an employee on a team, I love how they make dev environment setup incredibly consistent. I also like how you could build out a better developer onboarding experience for working with microservices.