-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-guide-windows
More file actions
77 lines (66 loc) · 1.8 KB
/
docker-guide-windows
File metadata and controls
77 lines (66 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Docker Guide (Windows + Docker Desktop)
This guide walks you through building and running the NestJS app in Docker on Windows (PowerShell or Command Prompt).
## Prerequisites
- Docker Desktop for Windows installed and running
- Terminal opened at the project root (same folder as `Dockerfile`)
## 1) Build the Docker image
Run in PowerShell or CMD:
```
docker build -t reading-tracker-app:latest .
```
## 2) Run the container (map port 3000)
Detached mode, mapping host port 3000 to container port 3000:
```
docker run -d --name reading-tracker -p 3000:3000 reading-tracker-app:latest
```
If port 3000 is in use on Windows, map a different host port (e.g., 8080):
```
docker run -d --name reading-tracker -p 8080:3000 reading-tracker-app:latest
```
## 3) Verify the app is running
- In a browser, open:
```
http://localhost:3000
```
- Or verify the public API endpoint. On Windows, prefer `curl.exe` to avoid PowerShell aliasing:
```
curl.exe http://localhost:3000/api/hello
```
Expected response:
```
{"success":true,"data":"Hello World!"}
```
## 4) View logs (optional)
Tail container logs:
```
docker logs -f reading-tracker
```
## 5) Stop and remove the container
Stop the container:
```
docker stop reading-tracker
```
Remove the stopped container:
```
docker rm reading-tracker
```
## 6) Rebuild and clean up tips
Rebuild without cache:
```
docker build --no-cache -t reading-tracker-app:latest .
```
Remove the image (forces clean rebuild next time):
```
docker rmi reading-tracker-app:latest
```
List running containers:
```
docker ps
```
List all containers (including exited):
```
docker ps -a
```
## Notes
- The container exposes port 3000 and starts via `node dist/src/main.js`.
- Static assets are served from `/app/public` and API routes include `/api`, `/users`, `/books`, `/reading`, `/auth`, `/admin`, `/friends`.