From zero to containerizing Python, React, Node.js & full-stack MERN apps β my complete Docker beginner notes.
πΊ Tutorial followed: Docker Masterclass by Adomic Arts
docker-demo/
βββ Dockerfile # My first Dockerfile β containerizing a Python app
βββ python/
β βββ demo.py # Python script that runs inside the container
βββ html/
βββ ... # HTML files copied into the container
Docker packages your app and everything it needs into a container β it runs the same way on any machine. No more "it works on my computer" problems!
- A Docker Image = the blueprint / recipe
- A Docker Container = a running instance of that image
- Containers are NOT full operating systems like VMs β they run one specific task
My very first Dockerfile (Python app):
FROM python
WORKDIR /user/app/src
COPY html /var/
COPY python/demo.py /user/app/src/
CMD ["python", "/user/app/src/demo.py"]| Instruction | What it does |
|---|---|
FROM |
Choose a base image to start from |
WORKDIR |
Set the working directory inside the container |
COPY |
Copy files from my machine into the container |
RUN |
Run a command while building the image |
EXPOSE |
Tell Docker which port the app uses |
CMD |
The command that runs when the container starts |
# Build an image from the Dockerfile
docker build -t image_name .
# Run a container
docker run --name container_name image_name
# Run in detached mode (background)
docker run --name container_name -d image_name
# List running containers
docker ps
# List ALL containers (including stopped)
docker ps -a
# Stop a running container
docker stop container_name
# Remove a stopped container
docker rm container_name
# List all images
docker images
# Remove an image (remove its containers first!)
docker rmi image_name
# Pull an image without running it
docker pull image_name
# Run a command inside a running container
docker exec container_name command
# Attach to a background container
docker attach container_id
# Remove EVERYTHING (containers, images, volumes)
docker system prune -aTo access an app running inside a container, map a host port to the container port:
docker run --name container_name -p 3000:5173 image_name
# β β
# host port container portDocker lets you version images using tags:
# Build with a tag
docker build -t image_name:v1 .
# Run a specific version
docker run --name container_name -p 3000:4000 image_name:v1Containers lose data when they stop. Volumes solve this by persisting data outside the container.
Anonymous Volume β temporary, no name:
docker run -d --name my_container -v /app/data my_imageNamed Volume β persists across restarts, shareable:
docker run -d --name my_container -v my_volume:/app/data my_imageBind Mount (Host Volume) β maps a folder on your machine directly:
docker run -d --name my_container -v /path/on/host:/path/in/container my_imagedocker volume create my_volume # Create a volume
docker volume ls # List all volumes
docker volume inspect my_volume # Inspect a volume
docker volume rm my_volume # Remove a volumedocker run --name container_name -p 3000:5173 --rm \
-v /app/node_modules \
-v ${PWD}:/app \
-e CHOKIDAR_USEPOLLING=true \
image_name
--rmautomatically removes the container when it stops β¨
Like .gitignore β tells Docker what NOT to copy into the image. Speeds up builds and keeps sensitive files out:
node_modules
.env
.git
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 5000
CMD ["npm", "start"]FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 5173
CMD ["npm", "run", "dev"]Docker Compose lets you define and run multiple containers together using a single docker-compose.yml file.
Example β Full Stack MERN app with MongoDB + API + Client:
services:
mongo:
image: mongo:latest
container_name: mongo_container
volumes:
- mongo_data:/data/db
ports:
- "27017:27017"
api:
build: ./api
container_name: api_container
ports:
- "5000:5000"
depends_on:
- mongo
volumes:
- ./api:/app
- /app/node_modules
environment:
- MONGO_URL=mongodb://mongo:27017/test-users
client:
build: ./client
container_name: client_container
ports:
- "3000:3000"
depends_on:
- api
stdin_open: true
tty: true
volumes:
- ./client:/app
- /client/node_modules
volumes:
mongo_data:
depends_onensures services start in the right order π
Share your images with the world!
docker login
docker tag image_name dockerhub_username/image_name:tag
docker push dockerhub_username/image_name:tagWhat is Docker?
β
Write first Dockerfile (Python app)
β
docker build & docker run
β
Port mapping for web apps
β
Image versioning with tags
β
Docker Volumes for data persistence
β
Dockerize React & Node apps
β
Docker Compose for MERN stack π
β
Push to Docker Hub βοΈ
- Docker networking (custom networks between containers)
- Multi-stage builds for smaller production images
- Docker secrets for managing sensitive data
- Introduction to Kubernetes
This repo is part of my Docker learning journey. I successfully completed the Crash Course: Docker For Absolute Beginners on KodeKloud!
| Field | Details |
|---|---|
| π Course | Crash Course: Docker For Absolute Beginners |
| π« Platform | KodeKloud |
| π€ Instructor | Mumshad Mannambeth (Founder & Trainer) |
| π Completed | July 16, 2026 |
| πͺͺ Certificate ID | 4db32d82-07f0-49b9-9ef2-27db18123a7a |
- πΊ Full Tutorial by Adomic Arts
- π KodeKloud β Docker For Absolute Beginners
- π Official Docker Docs
- π³ Docker Hub
This is my first Docker experience β built with curiosity, lots of terminal errors, and even more learning! π