Skip to content

100NikhilBro/devcontainer-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevContainer Lab

Learning and experimenting with VS Code Dev Containers, Docker-based development environments, and reproducible developer workflows.


Overview

This repository explores how Dev Containers standardize development environments and simplify project onboarding.

The goal of this project was not to build a feature-rich application, but to understand:

  • development environment standardization
  • Docker and Dev Containers
  • development workflow
  • Dev Container lifecycle
  • devcontainer.json
  • Dockerfile integration
  • workspace configuration
  • developer experience

The project was built step-by-step while experimenting with:

  • VS Code Dev Containers
  • Docker
  • Dockerfile
  • devcontainer.json
  • Workspace Mounts
  • Port Forwarding
  • Lifecycle Commands

Why Dev Containers?

Why Dev Containers

Explanation

Different developers often work with different operating systems, runtime versions, dependencies, and local configurations.

Although the application code is the same, the development environment is different.

Dev Containers solve this by providing a consistent development environment for every developer.


How Dev Containers Work

Workflow

Explanation

When a project containing a .devcontainer directory is opened, the editor reads the configuration, builds the development image, creates the container, mounts the workspace, installs the required development configuration, and attaches the editor to the container.

This provides a ready-to-use development environment with minimal manual setup.


Understanding devcontainer.json

devcontainer.json

Explanation

devcontainer.json is the central configuration file of a Dev Container.

It defines how the development environment should be configured, including build settings, workspace configuration, lifecycle commands, editor customization, and developer experience.

Unlike a Dockerfile, it focuses on configuring the development environment rather than building the container image.


Dev Container Lifecycle

Lifecycle

Explanation

A Dev Container follows a predictable lifecycle.

The image is built, the container is created, lifecycle commands are executed, the editor attaches to the container, and the development environment becomes ready for use.

This repository explores the purpose of each lifecycle stage and when it is executed.


Key Learnings

  • understanding why Dev Containers exist
  • difference between Docker and Dev Containers
  • Dev Container lifecycle
  • responsibilities of devcontainer.json
  • Dockerfile integration
  • workspace mounting
  • lifecycle commands
  • developer environment standardization

Project Structure

.
├── .devcontainer
│   ├── Dockerfile
│   └── devcontainer.json
│
├── config
├── src
├── .env.example
├── .gitignore
├── package.json
└── package-lock.json

Project Setup

Clone Repository

git clone https://github.com/100NikhilBro/devcontainer-lab.git

Install Dependencies

npm install

Open Inside Dev Container

  1. Start Docker Desktop
  2. Open the project in VS Code
  3. Install the Dev Containers extension
  4. Select Rebuild and Reopen in Container

Run Development Server

npm run dev

Conclusion

This repository was created to understand how Dev Containers improve developer workflows by providing consistent and reproducible development environments.

The focus was on learning the development lifecycle, configuration, and workflow rather than building a feature-heavy application.

Maintained by Nikhil Gupta.

About

Learning and experimenting with VS Code Dev Containers, Docker-based development environments, and reproducible developer workflows.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors