Docker Series - Part 14: Unveiling the Power of Linux Processes & Docker Internals


Behind every Docker container lies a fascinating story of Linux processes and the kernel magic that runs the show.
In this session, we’ll go deeper into how the Linux kernel manages processes, how Docker leverages that to isolate containers, and how every process has its own world inside the
/proc
directory.
1. Understanding Process IDs in Linux
Every time you run a command or start a program in Linux, a process is created. To inspect it:
pgrep firefox # Get the PID of Firefox
ps -aux # Show all running processes
The kernel assigns a unique Process ID (PID) to every process and links it to a directory in /proc
.
2. Meet the /proc Directory – A Window into Your RAM
cd /proc
ls
You’ll see folders like 2771
, 3442
, etc. — these are not random numbers; they are active process directories!
Each folder under /proc/[PID]
contains all the information about that specific process, like:
bashCopyEdit/proc/3442/
├── cmdline
├── environ
├── exe
├── root
├── status
└── ...
As soon as a process stops, its PID folder disappears from /proc
.
3. BASH is a Process Too!
Even your terminal is powered by a process:
echo $SHELL
pgrep bash
ps -aux | grep bash
You can even run another bash inside bash (yes, a nested process!).
4. Docker = Process in a Box
Let’s connect this with Docker:
docker run -dit --name os1 centos:7
docker ps
Now check processes:
ps -aux | grep bash
You’ll see /bin/bash
running — that’s the container’s primary process.
If you kill the process, the container stops.
kill -9 <PID>
docker ps # The container exits!
5. Containers = Process Trees with a Private Root
In containers, /
is remapped:
docker attach os1
cd /
ls
cat hi.txt
The data in /
comes from the image, not the host system.
Try removing the image while a container is running — it’ll fail because the container is using it.
docker rmi centos:7
# Error: image in use
6. CMD & ENTRYPOINT – Deciding the Process at Runtime
Inside the Docker image:
docker history centos:7
It uses CMD ["/bin/bash"]
by default. That’s why you land in a bash shell unless overridden.
This is the reason containers can run custom scripts, web servers, or anything — all thanks to how processes work under the hood.
Recap
Feature | Purpose |
/proc directory | Reflects memory structure of processes |
Process = Folder | Each PID has a folder in /proc |
Container = Process | Docker container is just a Linux process |
Kill PID = Stop container | Process termination = container exit |
/ inside container | Comes from image, not host |
Why This Matters
Knowing how Docker leverages native Linux process isolation gives you deeper control over containers:
✅ Process inspection
✅ Runtime debugging
✅ Image layering and isolation
✅ Docker performance optimization
Curious about how Docker isolates processes or how /proc
maps the memory world?
Let’s chat in the comments — always happy to geek out on containers!
Subscribe to my newsletter
Read articles from Nitin Dhiman directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Nitin Dhiman
Nitin Dhiman
Self-taught DevOps enthusiast on a journey from beginner to pro. Passionate about demystifying complex tools like Docker, AWS, CI/CD & Kubernetes into clear, actionable insights. Fueled by curiosity, driven by hands-on learning, and committed to sharing the journey. Always building, always growing 🚀