Start CODING IN MINUTES with DevContainers

· algiegray's blog


Key takeaways: #

  1. Dev containers allow developers to package their project and its environment (dependencies, tooling, etc.) in a container.
  2. Utilizing containers eliminates the need to install specific frameworks, tooling, and runtimes locally, streamlining the onboarding process for new projects.
  3. VS Code offers an extension called "Dev Containers" to integrate containerized development environments seamlessly.

What are Dev Containers? #

Getting started with Dev Containers #

Prerequisites #

Cloning and setting up a Dev Container-based project #

  1. Clone a repository with a Dev Container configuration file (e.g., containing a file).
  2. Open the cloned repository in VS Code.
  3. Follow the prompt to reopen the folder in a container.
  4. VS Code will build and launch the container with the specified environment, with all the required dependencies and runtimes installed.

Creating a new Dev Container #

  1. In VS Code, use the "Create Dev Container" command.
  2. Choose the desired starting point for your project (e.g., .NET, Go, PostgreSQL, etc.) from the available templates.
  3. VS Code will create a new container and set up the environment, installing any required dependencies and runtimes based on the chosen template.

Customizing Dev Containers #

Conclusion #

Dev containers facilitate the development process by enabling developers to work within fully isolated and customizable environments. By utilizing Dev containers, developers can streamline the onboarding process for new projects and eliminate compatibility issues between different projects with varying dependencies and runtime environments. The VS Code "Dev Containers" extension provides a seamless experience for integrating containerized development environments into a developer's workflow.

Summary for: Youtube