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

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
ifconfigcommand is used to check the IP address of your container or host.Ensure network connectivity between web server and client.
Note: If
ifconfigis missing, install it using thenet-toolspackage.
Setting Up a Basic Web Server Inside a Container
Steps:
Install Apache Web Server:
yum install httpdPlace Web Content: Save or create your webpage inside:
/var/www/htmlStart Web Service:
httpd
That’s it — your basic web server is up and running!
Working with Containers More Effectively
Detach Without Stopping:
PressCtrl + p + qto 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 /dataRun a container and mount the volume:
docker run -it --name webserver -v /data:/var/www/html httpdStore data inside the container: Any files created in
/var/www/htmlinside the container will be stored in/dataon the host system.Delete the container:
Even after deletion, data remains safe on the host!
Bonus Linux Commands
Check all running processes:
ps -auxAccess 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.






