DOCKER
Complete Notes for Beginners
Concepts • Commands • Examples
RUSHI INFOTECH
★ WISE LEARNERS ★
Online Docker Tutorials — Reference Notes
DOCKER — Complete Notes
Rushi Infotech • Wise Learners
Table of Contents
# Topic Page
1 What is Docker? 3
2 Why Use Docker? 3
3 Key Concepts (Image, Container, Registry) 4
4 Docker Architecture 5
5 Image vs Container — The Big Difference 5
6 Container Lifecycle 5
7 Command Reference — Quick Cheat Sheet 6
8 Commands Explained One-by-One 7
9 Real Practice Session (from class) 10
10 Common Mistakes & Tips 11
© Rushi Infotech — Docker Tutorials Page 2
DOCKER — Complete Notes
Rushi Infotech • Wise Learners
PART A — Concept-wise Notes
1. What is Docker?
Docker is an open-source platform that lets us build, ship, and run applications inside small,
isolated boxes called containers. A container packs your application together with everything it
needs to run — code, libraries, settings, and dependencies — so it works the same way on every
computer.
Simple idea: Think of a container as a lunchbox. Whatever food (application) you put inside, it stays
fresh and tastes the same — whether you open it at home, in office, or in the cloud.
2. Why Use Docker?
Benefit Meaning in Simple Words
Portability Runs the same on your laptop, a server, or cloud.
Lightweight Uses far less memory than a Virtual Machine.
Fast Containers start in seconds, not minutes.
Isolation Each app runs in its own box — no conflicts.
Easy to Share Push images to Docker Hub, pull anywhere.
Save Time No more “it works on my machine” problem.
© Rushi Infotech — Docker Tutorials Page 3
DOCKER — Complete Notes
Rushi Infotech • Wise Learners
3. Key Concepts You Must Know
3.1 Docker Image
An image is a read-only template used to create containers. It contains the operating system,
application code, libraries, and tools. Images are stored in Docker Hub (a public library) or in a
private registry. You download (pull) an image and then run it to create a container.
Example: ubuntu, ubuntu:22.04, alpine/java:22-jdk — these are all images.
3.2 Docker Container
A container is a running instance of an image. You can start it, stop it, restart it, rename it, or
delete it. You can run many containers from the same image at the same time — each one is
independent.
3.3 Docker Hub (Registry)
Docker Hub is a giant online library of ready-made images. When you run docker pull
ubuntu, Docker downloads the image from Docker Hub and saves it on your computer.
3.4 Dockerfile
A Dockerfile is a small text file with step-by-step instructions to build your own image. (Covered in
detail in advanced classes.)
3.5 Docker Engine / Daemon
The Docker Engine is the background service that actually runs containers on your machine. When
you type a docker command, the Docker Client sends it to the Docker Daemon, which does the real
work.
© Rushi Infotech — Docker Tutorials Page 4
DOCKER — Complete Notes
Rushi Infotech • Wise Learners
4. Docker Architecture (Simple View)
Docker follows a Client–Server model with three main parts:
Part What it Does
1. Docker Client The terminal where YOU type commands like docker run, docker pull.
It sends requests to the Docker Daemon.
2. Docker Daemon The background engine. It builds images, runs containers, manages
(dockerd) networks and storage.
3. Docker Registry The storage for images (Docker Hub by default). Daemon pulls
images from here when needed.
Flow: You (Client) ➜ Docker Daemon ➜ Pulls image from Registry ➜ Creates Container ➜
Container Runs Your App
5. Image vs Container — The Big Difference
Image Container
Read-only template Running instance of an image
Like a class in OOP Like an object made from the class
Stored on disk Lives in memory while running
You ‘pull’ it You ‘run’ it
Listed by: docker images Listed by: docker ps / docker ps -a
Removed by: docker rmi <id> Removed by: docker rm <id>
6. Container Lifecycle (States)
A container moves between these states during its life:
State How it Happens
Created docker create — container made but not started
Running docker run / docker start — actively executing
Paused docker pause — temporarily frozen
Stopped docker stop — process ended, can be restarted
Deleted docker rm — removed forever
© Rushi Infotech — Docker Tutorials Page 5
DOCKER — Complete Notes
Rushi Infotech • Wise Learners
PART B — Command-wise Notes
7. Quick Cheat Sheet
Print this page and keep it next to your laptop. These are the commands you will use every day.
Command What it Does
docker --version Show installed Docker version
docker pull <image> Download an image from Docker Hub
docker images List all images on your system
docker run -it <image> Create + start a container (interactive)
docker run -itd <image> Run container in background (detached)
docker ps List running containers only
docker ps -a List ALL containers (running + stopped)
docker start <id> Start a stopped container
docker attach <id> Connect to a running container’s terminal
docker stop <id> Gracefully stop a running container
docker restart <id> Stop and start a container again
docker rename <old> <new> Give a container a new name
docker rm <id> Delete a stopped container
docker rm -f <id> Force delete (even if running)
docker rmi <image-id> Delete an image
exit / Ctrl + P + Q Exit container (exit stops it; Ctrl+P+Q keeps it running)
© Rushi Infotech — Docker Tutorials Page 6
DOCKER — Complete Notes
Rushi Infotech • Wise Learners
8. Commands Explained One-by-One
Each command below has its purpose, example, and a note from class. Practice them in the same
order.
8.1 docker pull
Command docker pull <image-name>[:tag]
Purpose Downloads an image from Docker Hub to your local machine.
Example $ docker pull ubuntu
$ docker pull ubuntu:22.04
$ docker pull ubuntu:24.04
$ docker pull alpine/java:22-jdk
Note If you don’t mention a tag, Docker pulls the ‘latest’ version by default.
8.2 docker images
Command docker images
Purpose Lists all images stored locally with their ID, tag, size, and creation date.
Example $ docker images
Note Use the IMAGE ID (first few letters are enough) to refer to an image in other
commands.
8.3 docker run
Command docker run [options] <image>
Purpose Creates a NEW container from an image and starts it. The most-used command.
Example $ docker run -it ubuntu
$ docker run -it f3d28607ddd7
$ docker run -itd 962f6cadeae0
Note Flags: -i = interactive, -t = terminal, -d = detached (background). Use -itd to keep
a container running in the background.
8.4 docker ps / docker ps -a
© Rushi Infotech — Docker Tutorials Page 7
DOCKER — Complete Notes
Rushi Infotech • Wise Learners
Command docker ps (running only)
docker ps -a (all containers)
Purpose Lists containers. Without -a you only see RUNNING ones; with -a you see
running + stopped + exited.
Example $ docker ps
$ docker ps -a
Note Look at the STATUS column — ‘Up’ means running, ‘Exited’ means stopped.
8.5 docker start
Command docker start <container-id-or-name>
Purpose Starts a container that was previously stopped. It does NOT create a new one.
Example $ docker start 934b1a439cfd
Note Use ‘docker ps’ after this to confirm it is running.
8.6 docker attach
Command docker attach <container-id>
Purpose Connects your terminal to a RUNNING container so you can type commands
inside it.
Example $ docker attach 934b1a439cfd
$ docker attach 6b8c9216dec1
Note To leave WITHOUT stopping the container, press Ctrl + P then Ctrl + Q. If you
type ‘exit’, the container will stop.
8.7 docker stop
Command docker stop <container-id>
Purpose Gracefully stops a running container (sends shutdown signal, waits 10 seconds).
Example $ docker stop 6b8c9216dec1
Note After stop, the container still exists. Run ‘docker ps -a’ to see it.
8.8 docker restart
© Rushi Infotech — Docker Tutorials Page 8
DOCKER — Complete Notes
Rushi Infotech • Wise Learners
Command docker restart <container-id>
Purpose Stops the container and starts it again — useful after a config change.
Example $ docker restart 934b1a439cfd
Note Faster than typing stop and then start separately.
8.9 docker rename
Command docker rename <old-name> <new-name>
Purpose Gives the container a new, friendlier name.
Example $ docker rename quirky_kirch dockerrushi
Note Docker auto-assigns funny names (like ‘quirky_kirch’). Rename them to
something meaningful for your project.
8.10 docker rm
Command docker rm <container-id> (stopped container)
docker rm -f <container-id> (force, even if running)
Purpose Permanently deletes a container.
Example $ docker rm 6b8c9216dec1
$ docker rm 934b1a439cfd
$ docker rm 934b1a439cfd -f
Note Plain ‘docker rm’ fails if the container is still running. Use -f to force-remove.
8.11 docker rmi
Command docker rmi <image-id> [<image-id> ...]
Purpose Removes one or more images from your local machine.
Example $ docker rmi f3d28607ddd7
$ docker rmi c4a8d5503dfb 962f6cadeae0 f1537f450ab5
Note If any container is still using the image, delete the container first, or use -f to
force.
© Rushi Infotech — Docker Tutorials Page 9
DOCKER — Complete Notes
Rushi Infotech • Wise Learners
9. Real Practice Session (from class)
Below is the exact sequence we ran in class, in the right order. Try the same on your machine — it
covers everything we have learned.
# Step 1 — Pull base images
docker pull ubuntu
docker pull ubuntu:24.04
docker pull ubuntu:22.04
docker pull alpine/java:22-jdk
# Step 2 — Verify what we have
docker images
# Step 3 — Run a container interactively
docker run -it f3d28607ddd7
# Step 4 — Check running and all containers
docker ps
docker ps -a
# Step 5 — Start, attach, stop, restart
docker start 934b1a439cfd
docker attach 934b1a439cfd
docker stop 6b8c9216dec1
docker restart 934b1a439cfd
# Step 6 — Run a container in the background (detached)
docker run -itd 962f6cadeae0
docker attach 6b8c9216dec1
# Step 7 — Rename a container
docker rename quirky_kirch dockerrushi
# Step 8 — Cleanup containers
docker rm 6b8c9216dec1
docker rm 934b1a439cfd
docker rm 934b1a439cfd -f
# Step 9 — Cleanup images
docker rmi f3d28607ddd7
docker rmi c4a8d5503dfb 962f6cadeae0 f1537f450ab5
docker images
© Rushi Infotech — Docker Tutorials Page 10
DOCKER — Complete Notes
Rushi Infotech • Wise Learners
10. Common Mistakes & Pro Tips
Mistake — ‘exit’ inside a container stops it.
If you want to keep the container running while leaving the terminal, press Ctrl + P then Ctrl + Q.
Mistake — ‘docker rm’ failed because container is running.
Either stop it first (docker stop <id>) or force-delete with docker rm -f <id>.
Mistake — ‘docker rmi’ failed because image is in use.
Remove the container that uses the image first, then delete the image.
Tip — You don’t need the full container ID.
First 3–4 characters are enough, e.g. docker stop 6b8.
Tip — Always check before deleting.
Run docker ps -a and docker images to confirm what you are about to remove.
Tip — Use names instead of IDs.
Rename your containers (docker rename) so you can use easy names like dockerrushi in
commands.
Keep practising daily. Docker is best learned by typing — not by reading.
— Rushi Infotech, Wise Learners —
© Rushi Infotech — Docker Tutorials Page 11