Installing Apache2 in a Docker Container (Step by Step)
Step 1: Run an Ubuntu Container
Installing Apache2 in a Docker Container (Step by Step)
By Gaurav Tevathiya Principal AI/ML, Cloud & Data Architect
Step 1: Run an Ubuntu Container
root@CB-DOCKER:/# docker container run -it ubuntu /bin/bash
Step 2: Update Packages
root@5d7cac5f4b3f:/# apt -get update
Always update the package list before installing new software.
Step 3: Install Apache 2 on Container
root@5d7cac5f4b3f:/# apt-get install apache2
Do you want to continue? [Y/n] y
Step 4: Go to Web Directory
# This is the default directory where Apache serves website files.
root@5d7cac5f4b3f:/# cd /var/www/html/
# Create Your Own Web Page
root@5d7cac5f4b3f:/var/www/html# echo "Welcome to Cloud Blogger Master DevOps Trainig" > index.html
root@5d7cac5f4b3f:/var/www/html# service apache2 start
# Start Apache2 Service
root@5d7cac5f4b3f:/var/www/html# service apache2 start
* Starting Apache httpd web server apache2
# Check Apache2 Service
root@5d7cac5f4b3f:/var/www/html# service apache2 status
* apache2 is running *
Step 5: Find the Container IP
From another terminal on the Docker host:
# Check Container IP
root@CB-DOCKER:/# docker container inspect 5d7cac5f4b3f
This will show you the internal container IP (usually something like 172.17.x.x).
Step 6: Test Apache
root@CB-DOCKER:/# curl http://172.17.0.2
Welcome to Cloud Blogger Master DevOps Trainig
Congratulations! You have successfully installed and tested Apache2 inside a Docker container
👉 If you found this guide helpful and would like to learn live directly from me, feel free to contact me via email: connect@cloudblogger.in
메타데이터
- post_id
- cbb72b9e5a09
- slug
- installing-apache2-in-a-docker-container-step-by-step-cbb72b9e5a09
- url
- https://medium.com/cloudblogger/installing-apache2-in-a-docker-container-step-by-step-cbb72b9e5a09
- canonical_url
- https://medium.com/cloudblogger/installing-apache2-in-a-docker-container-step-by-step-cbb72b9e5a09
- author_url
- https://medium.com/@cloudbloggeracademy
- status
- ok
- fetched_at
- 2026-06-11 17:15:47