Docker: A Beginner-Friendly Dive into Containers
Hey Folks!
First of all, thanks for appreciating my first blog . So, for my second blog, I thought why not write about Docker?
These days, we hear about containers, DevOps, and microservices everywhere and Docker always comes up in the conversation. Many people use it daily, but I’ve noticed that some people still find parts of it confusing.
So here’s my little contribution, let’s break Docker down together, from what it is to how you actually use it on Windows and Linux, with practical commands and examples.
What is Docker?
In the simplest words: Docker lets you package your app along with everything it needs to run — and ship it anywhere.
Think of it like this:
Imagine you have to send a delicate cake to a friend. You’d pack it in a secure box so it doesn’t get ruined, right? Docker does the same for your app it puts your code plus all its dependencies into a neat “container”. So whether you run it on your laptop, your friend’s PC, or a cloud server, the behavior stays the same.
So How does Docker Actually work?
Docker Taxonomy: Understanding How It All Fits Together
Imagine you’re in a kitchen. You have recipes, dishes being cooked, and a pantry where you store all your recipes. Docker works in a very similar way.
At the heart of Docker are containers. A container is like a dish you’re preparing — it’s your application running in a controlled environment. But before you can make a dish, you need a recipe. In Docker, that recipe is called an image. An image contains everything your app needs to run: the code, libraries, dependencies, and the environment itself.
Once you have your images, you need a place to keep them so you can use them anytime or share them with others. This place is called a registry. Think of it like a cookbook or a library. Registries can be private (inside your organization) or public, like Docker Hub or cloud registries from AWS, Azure, or Google. You can pull images from a registry to run containers or push your own images to share with others.
Get Sandeepmishra’s stories in your inbox
Join Medium for free to get updates from this writer.
In simple terms:
- Image = Recipe (defines what the app needs)
- Container = Dish (the app running, cooked from the recipe)
- Registry = Cookbook/library (where all recipes are stored, locally or in the cloud)
This taxonomy helps you understand how Docker organizes your applications, making them easy to build, run, and share anywhere.
This diagram illustrates how Docker works in a simple, visual way. On the left, you have the Client — this is where you type Docker commands like docker build, docker pull, and docker run. These commands talk to the Docker Host (the middle section), which is like the engine room of Docker. Inside the host, the Docker daemon manages everything - it creates and runs Containers (shown as little shipping containers) from Images (templates for your applications, represented by Ubuntu and Redis logos). When you need new images, Docker can fetch them from the Registry on the right (like Docker Hub), which is essentially an online library storing thousands of ready-to-use application templates. Think of it like this: the client gives orders, the Docker host executes them by creating isolated containers from images, and when needed, it can download new images from the online registry to expand what you can run.
Running Docker on Windows vs. Linux
For Windows Users
- Download Docker Desktop from the official Docker website.
- Open Command Prompt or PowerShell.
- Check your installation with:
docker --versionIf you see the version number, Docker is installed successfully!
For Linux Users
Update your system:
sudo apt updateInstall Docker:
sudo apt install docker.io -yVerify installation:
docker --versionAnd you’re ready to go!
Docker Basics: Commands You’ll Use Every day
Most common Docker commands:
- Build an Image
docker build -t myapp:latest .-t myapp:latest→ gives your image a name and tag..→ means “use the Dockerfile in the current folder.”- Run a Container
docker run -d -p 5000:5000 myapp:latest-d→ run in background (detached mode).-p 5000:5000→ maps port 5000 of your machine to port 5000 of the container.- Check Running Containers
docker ps- Stop a Container
docker stop <container_id>- Remove a Container
docker rm <container_id>- See All Images
docker imagesSaving and Loading Docker Images
Sometimes you may want to export an image (for backup, sharing, or moving to another system without pulling from Docker Hub). That’s where save and load come in handy.
Save an Image to a File
docker save -o myapp.tar myapp:latest-o myapp.tar→ saves the image as a.tarfile.myapp:latest→ the image you want to export.
Now you can copy myapp.tar to another machine (via USB, SCP, etc.).
Load an Image from a File
docker load -i myapp.tar-i myapp.tar→ imports the saved image back into Docker.
After loading, you can check with:
docker imagesYou’ll see your image available and ready to run.
Writing Your First Dockerfile
A Dockerfile tells Docker how to build your container.
An example for a simple Python app:
# Use Python image
FROM python:3.9# Set working directory
WORKDIR /app# Copy everything into /app
COPY . /app# Install dependencies
RUN pip install -r requirements.txt# Run the app
CMD ["python", "app.py"]
Once you have this file in your project folder, you can build and run your app using the commands we learned earlier.
Why Docker is a Game-Changer
Before Docker, developers often faced the “it works on my machine” problem. Code ran differently on different systems because of mismatched environments or missing dependencies.
Docker fixes this by creating consistent environments. Whether you’re on Linux, Windows, or the cloud, your app will behave the same way.
It’s also a cornerstone of modern practices like:
- DevOps — Continuous Integration & Deployment (CI/CD).
- Microservices — Breaking big apps into smaller, manageable services.
- Cloud Computing — Running apps anywhere without worrying about setup.
Final Thoughts
Docker is not just a tool it’s a mindset shift in how we build, ship, and run software. Once you get the hang of it, you’ll wonder how you ever lived without it!
Stay tuned for more updates.
Progress favors the minds that stay curious. Keep reading, keep thinking.




