Creating a Dev Container for TypeScript and VS Code — Part 1
Full-time nodejs dev container for less installation effort and more consistency.
--
In this article:
- Minimizing pre-requisites
- Detailed explanation of dev container related files
- Creating a Dev Container for TypeScript
- Controlling the content of the dev container
- Controlling the version of nodejs and npm
- Selecting VS Code Extensions
- Bonus: Resolving Some Common Issues in Corporate Environments
This is part 1 of a two-part article. Part 2 can be found here.
Introduction
Containerization as a concept for deploying SaaS (Software as a Service) products has now been established for quite some time. AWS, Azure, Google, Portainer and others offer a range of options for deploying and managing container-based systems.
In this article I will demonstrate how to create a dev container for TypeScript from scratch. You will need to have a basic understand of Docker. You need to understand the difference between a container image (short “image”) and a container instance (aka “container”) and how a container is different to a virtual machine.
Also, you need to have some initial experience with VS Code and how extension add functionality to VS Code. Some familiarity with some basic bash commands won’t hurt but I’ll explain them along the way.
The complete source code for this article is available at https://github.com/RimuTec/dev-container-typescript/tree/part-1. Be aware, though, that the git repository may contain newer versions of the code base.
Windows Only: There are a couple of points of interest for readers on a Windows computer. Additional details are provided in italics like this paragraph. Non-Windows users can skip those paragraphs.
Windows Only: If you are on Windows like me, be prepared that we will be using WSL2. We will be using the Linux files system instead of the Windows file system (NTFS). For reasons, please see my earlier article “Docker Desktop on WSL2: The Problem with Mixing…