Setting up Windows 10 for web development, including Docker, Linux, and Node.js
I recently had a catastrophic crash of my desktop, so it was time for a fresh Windows 10 install. Which also meant getting my development environment set back up. Modern webdev environments have a lot going on, especially when you throw Docker into the mix, and there are always a bunch of little useful Windows tweaks that are easy to forget. So I documented all the details for future reference, and to share.
Programs to Install
If you’ll be running Docker (see below), then a lot of your webdev needs can be met by various Docker images. Outside of those, the core programs I use for web development are:
- Git
- GitHub Desktop for easy cloning and repo management, if you use GitHub.
- GitHub CLI if you’re into that sort of thing.
- Visual Studio Code (turn on “Settings Sync” and log in to make your dev setup more portable, and get all the good extensions to make coding a blast.)
- Node.js (I suggest the latest LTS)
- Discord, assuming you’re in some servers
- Chrome — I suggest logging into Chrome to sync your settings (choose which ones!)
- Firefox — Still a popular enough browser you may want to support it
- Edge — the version that ships with Windows 10 is probably out of date
- LastPass (for all browsers) — you may need this, or some alternative password manager, before logging into your browsers
Setting up Linux and Docker (via WSL2)
You can get fantastic Docker + Linux support via “Windows Subsystem for Linux 2” (WSL2).
You can work through the official Docker docs and the official WSL2 installation docs, which will soon become more up to date than this post. Alternatively, I’ve tried to distill all the steps and make things easier to follow.
Here’s how to get Linux + Docker running on Windows for web development:
- Get Linux running via WSL2.
- Download and install Docker Desktop
- Once Docker is running, get into its settings (via the tray icon, running from the desktop shortcut, or from the start menu), then go to
Resources
→WSL Integration
, and turn on integration with your installed Linux distro. - Log into your new Linux distro via
Start
→wsl
, then:
- Install Node.js for your distro
- Add an SSH key for GitHub (or whatever you need one for). You could use other auth approaches, but I generally find SSH to be easiest on Linux. You may want to auto-run your SSH agent when you log in.
Whew, now you’re all set up!
To run your distro, you can directly go to Start
→ wsl
, or you can run the wsl
command inside PowerShell or your favorite terminal.
Important: if your Docker containers will be accessing files, make sure those files are in the Linux filesystem instead of the mounted Windows one (otherwise performance is terrible). Once you’ve logged into your Linux distro, you can run cd ~
to get to your home folder inside the Linux filesystem.
When Docker is running on Windows, you can run the docker
and docker-compose
commands from within your Linux distro.
VSCode with WSL2
If you set up WSL2, you can launch VSCode in a Linux directory by running the code .
command in Linux. The first time you do this, VSCode will offer recommended extensions that will make things run as smoothly as possible. Install those. The next time you do this, some other stuff will get installed. After that everything will work like magic.