← Back to list

Configure the Apache web server on the docker container

Introduction

Arpit Sharma · 2024-11-05 17:23 · 3 claps · 2.0 min read
#docker #apache #web-server #containerization #httpd
Open on Medium ↗
Wiki topics: ☁️ · DevOps & Cloud

Configure the Apache web server on the docker container

Introduction

Apache is one of the most widely used web servers. It is powerful, flexible, and easy to configure. We can containerize Apache by using Docker, making it easy to deploy and manage across environments. This guide walks through each step, from setting up Docker to customizing the Apache configuration within a container.

Step 1: Setting Up Your Docker Environment

sudo su - root
yum install docker

Step2: Start the Docker service:

systemctl start docker 
systemctl enable docker

Step3: pull the image

docker pull centos:7

Step4: create a container

docker run -it --name new1 -p 1234:80 centos:7

Step5: Now let’s install httpd

yum install httpd -y

Step6: Store the message in the HTML folder

cd /var/www/html/
vi my.html
cat my.html

Step7: start the httpd server

httpd
ps -aux

Step8: install net-tools and check the current ip

yum install net-tools
ifconfig

Step9: see the output through curl

curl http://172.17.0.2/sachin.html

Step10: successfully configure the web server on the container

And that’s how we have successfully configured the Apache web server on a Docker container.

Thank you for reading.

Follow for more content:-

Linkedin:- https://www.linkedin.com/in/arpit-sharma-4895b8220/


메타데이터
post_id
6403ace95319
slug
configure-the-apache-web-server-on-the-docker-container-6403ace95319
url
https://medium.com/@arpit23sh/configure-the-apache-web-server-on-the-docker-container-6403ace95319
canonical_url
https://medium.com/@arpit23sh/configure-the-apache-web-server-on-the-docker-container-6403ace95319
author_url
https://medium.com/@arpit23sh
status
ok
fetched_at
2026-06-27 23:56:40