# Docker for Full Stack Developers
"It works on my machine" is the exact problem Docker exists to solve. A container packages your app with everything it needs to run, so it behaves the same way everywhere.
## Containers vs Virtual Machines
A virtual machine emulates an entire operating system, which is heavy. A container shares the host OS kernel and only packages the application and its dependencies, making it far lighter and faster to start.
## A Basic Dockerfile
```dockerfile
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]
```
Each line creates a layer, and Docker caches layers that haven't changed — ordering `COPY package*.json` before the rest of the code means dependency installs aren't repeated on every code change.
## Building and Running
```bash
docker build -t masterpath-app .
docker run -p 3000:3000 masterpath-app
```
## Docker Compose for Multi-Service Apps
Most real apps need more than one container — the app itself, a database, maybe Redis. Docker Compose defines and runs them together:
```yaml
services:
app:
build: .
ports: ["3000:3000"]
db:
image: postgres:16
environment:
POSTGRES_PASSWORD: password
```
## Why It Matters for Full Stack Developers
Docker ensures your local development environment matches production closely, and it's the foundation most cloud deployment platforms (including AWS and many CI/CD pipelines) build on top of.
## Conclusion
You don't need to master Kubernetes to benefit from Docker — understanding containers and writing a basic Dockerfile already solves most environment consistency problems full stack developers run into.
Back to Blogs
Docker for Full Stack Developers
Why Docker matters for full stack developers — containers explained simply, with a practical Dockerfile example.
25 Jul 2026
6 min read