Introduction
Today I set up Docker from scratch on my Linux machine, ran my first containers, explored how Docker tracks images and containers under the hood, and cleaned up my environment afterward. Here is what I learned along the way.
1. Docker Explained Simply
- What is Docker? A tool that packages an app and everything it needs to run into one neat, portable box.
- What problem does Docker solve? It solves the problem of apps breaking when you move them to a teammate's computer or a production server. Docker packages your app and all required tools (dependencies) into one portable bundle (called an image), so it runs the same everywhere.
- What is the difference between an Image and a Container? An Image is the read-only blueprint/recipe, while a Container is the live, running instance created from that image.
- Why is Docker called "containerization" and not virtualization? Containers share the host computer's OS kernel(the core engine of the operating system) instead of booting up a heavy, full guest operating system as a Virtual Machine does. Containerization (Docker) is like an apartment building: all the apartments share the building's main foundation and plumbing (in tech terms, the host computer's OS kernel). Virtualization (using Virtual Machines) is like building a separate house for every app. Each house needs its own plumbing, electricity, and foundation; this means every Virtual Machine has to boot up its own heavy, full operating system (like Windows or Linux). That takes up a lot of memory and starts up slowly.
- Where are Docker images stored before reaching your computer? They live in remote cloud registries (most commonly Docker Hub) until you pull them down.
2. Installing Docker & Checking Its Health
I followed Docker's official Linux installation guide to get the engine running on my system. To confirm Docker was installed and healthy, I checked the version and service status:
docker --version
sudo systemctl status docker
3. Running My First Containers
Hello World
Next, I ran the classic test container:
docker run hello-world
-
Did Docker already have the image? Docker checked locally first, didn't find
hello-world, automatically pulled it from Docker Hub, and then ran it.
Interactive Ubuntu Shell
Then I ran an interactive Ubuntu container:
docker run -it ubuntu bash
-
What happened? Docker checked locally first, didn't find
ubuntu, automatically pulled it from Docker Hub, and then ran it. I was dropped straight into a bash terminal inside the isolated Ubuntu container, and typingexitstopped the container and brought me back to my host Linux prompt.
4. Investigating My Environment
Before deleting anything, I inspected what was sitting on my machine:
-
Images on my machine:
docker images -
Currently running containers:
docker ps -
All containers (including stopped ones):
docker ps -a
5. Leaving No Zombies (Cleanup)
Since stopped containers and unused images still take up disk space, I cleaned everything up:
# Remove the stopped containers
docker rm 879af2055c38 b991d7810fa9
# Remove the downloaded images
docker rmi hello-world ubuntu
Finally, I ran docker ps -a and docker images one last time to verify my environment was completely clean.





Top comments (0)