Docker Series — Part 3: Running Containers, Managing Storage, and Setting Up a Web Server

Table of contents

Welcome back to the third installment of the "Docker: Basics to Advance" series!
In this part, we’ll move beyond theory into real hands-on Docker commands*, container management, basic networking, and even setting up a simple web server inside a container*
Quick Recap
Before we jump ahead, let’s quickly recall:
Docker uses containerization to launch operating systems within seconds.
Containers are created using images.
Docker Engine is the software that runs Docker.
Every container is assigned a unique ID and optionally, a custom name.
Docker Essential Commands You Must Know
Managing containers and images effectively requires mastering some basic commands:
Networking Essentials
ifconfig
command is used to check the IP address of your container or host.Ensure network connectivity between web server and client.
Note: If
ifconfig
is missing, install it using thenet-tools
package.
Setting Up a Basic Web Server Inside a Container
Steps:
Install Apache Web Server:
yum install httpd
Place Web Content: Save or create your webpage inside:
/var/www/html
Start Web Service:
httpd
That’s it — your basic web server is up and running!
Working with Containers More Effectively
Detach Without Stopping:
PressCtrl + p + q
to safely exit the container without stopping it.Run Commands Directly Inside a Container:
docker exec <container_name> <command>
Example:
docker exec webserver ls /var/www/html
Understanding Docker Storage
There are two types of storage when working with containers:
Type | Description |
Ephemeral Storage | Temporary, data lost when container is deleted (like C drive) |
Persistent Storage | Data survives container deletion (like external hard drives) |
How to Create Persistent Storage with Docker Volumes
Create a directory on the base system:
mkdir /data
Run a container and mount the volume:
docker run -it --name webserver -v /data:/var/www/html httpd
Store data inside the container: Any files created in
/var/www/html
inside the container will be stored in/data
on the host system.Delete the container:
Even after deletion, data remains safe on the host!
Bonus Linux Commands
Check all running processes:
ps -aux
Access Web Pages via CLI (without browser):
curl <server-ip>
Force kill a running process:
kill -9 <process_id>
Conclusion
In this blog, we moved from simple theory to powerful hands-on Docker practices:
Managing containers and images
Setting up networking and web servers
Understanding persistent storage
Using CLI tools for container and service management
This is the foundation of real-world Docker usage — making you not just someone who knows Docker, but someone who builds with Docker
Coming Up Next:
In Part 4, we’ll explore:
Writing and using a Dockerfile
Building your own custom Docker images
Best practices for container optimization
Stay tuned — the journey from Basics to Advance continues
If you need any help with Docker concepts, feel free to reach out! Let's learn, share, and grow together.
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 🚀