Cloud Native 8 min read

Build a Containerized Development Environment with VS Code and Docker

This guide shows how to use Docker and VS Code's Remote‑Containers extension to create a standardized, container‑based local development setup that speeds onboarding, ensures consistency across team members, and simplifies dependency management.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Build a Containerized Development Environment with VS Code and Docker

Using Docker and VS Code Remote‑Containers, you can create a containerized local development environment that standardizes tools and dependencies for the whole team, making onboarding faster and setups consistent.

Why Use a Containerized Environment?

Team members often face mismatched configurations and version conflicts. Providing a pre‑configured container ensures everyone works with the same base image, editor extensions, and settings, reducing setup friction.

Setup Steps

Install Docker and VS Code, then add the Remote‑Containers extension.

Create a .devcontainer folder at the project root.

Inside it, add a Dockerfile and a devcontainer.json with the desired configuration.

# Specify the base image you want your dev container to use.
# You may use the same exact base image your application would use in production for consistency.
# That could prevent surprises such as "works in local, but not in PROD".
FROM node:14.17.0-alpine

# Install additional dependencies (e.g., Git).
RUN apk update
RUN apk add git

{
  "name": "DevContainer ReactApp",
  "dockerFile": "Dockerfile",
  "initializeCommand": "yarn install",
  "postStartCommand": "yarn start",
  "forwardPorts": [3000],
  "extensions": [
    "dbaeumer.vscode-eslint",
    "esbenp.prettier-vscode",
    "eamodio.gitlens"
  ]
}

After configuring, open the folder in VS Code and select “Open Folder in Container” or “Reopen in Container”. VS Code will build the image, start the container, and launch the development server.

Benefits

The file system is synchronized between the container and host, so code is accessible from either environment.

Multiple applications with different dependency versions can run side‑by‑side without polluting the host system.

Any team member, including non‑technical contributors, can run, edit, and test the code.

The application runs independent of the host OS.

Common Issues & Solutions

Use the VS Code terminal for container commands; for host‑level tools, locate the container and run docker exec.

If the app needs more CPU or memory, adjust Docker’s resource limits.

Limitations

Not ideal for projects requiring extensive integration outside the container.

Advanced users may prefer other editors or manual setups.

Resource‑heavy applications can strain Docker on limited machines.

Conclusion

Container‑based development simplifies environment management and improves consistency, though it may not suit every workflow. Try it out and share your experiences.

DockercontainerizationVS CodeDev EnvironmentRemote Containers
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.