← Back to list

Set-up Apache Web-Server inside Docker Container

In this blog Created Dockerfile for Set-up Httpd Web Server inside Container.

Pratik Shinde · 2025-03-09 14:01 · 0 claps · 2.0 min read
#docker #apache #httpd #dockerfiles #web-server
Open on Medium ↗
Wiki topics: ☁️ · DevOps & Cloud

Set-up Apache Web-Server inside Docker Container

In this blog Created Dockerfile for Set-up Httpd Web Server inside Container.

Thumbnail

Thumbnail

Step: 1-Create index.html webpage file.

We can also use AI for create such webpage(Index.html is AI generated). Here you can replace just your GitHub, LinkedIn, Medium links in this Code.

index.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>WELCOME TO PRATIK SHINDE Default Webpage</title>
    <link rel="stylesheet" href="styles.css">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
</head>
<body>

    <!-- Main Container -->
    <div class="main-container">
        <!-- Header -->
        <header>
            <h1>WELCOME TO PRATIK SHINDE</h1>
            <p>Connect with me on my social platforms!</p>
        </header>

        <!-- Social Platforms Buttons -->
        <div class="social-buttons">
            <a href="https://github.com/Pratikshinde55/" target="_blank" class="social-button github">
                <i class="fab fa-github"></i> GitHub
            </a>
            <a href="https://www.linkedin.com/in/pratikshinde55/" target="_blank" class="social-button linkedin">
               <i class="fab fa-linkedin"></i> LinkedIn
            </a>

            <a href="https://medium.com/@pratikshinde2210/" target="_blank" class="social-button medium">
                <i class="fab fa-medium"></i> Medium
            </a>
        </div>
    </div>

</body>
</html>

Dockerfile:

FROM httpd
WORKDIR /usr/local/apache2/htdocs/
COPY index.html index.html
EXPOSE 80
CMD ["httpd-foreground"]

Step:3-Build image & Run/Launch Container

Note: Dockerfile, and webpage index.html put in same directory.

docker build -t pratikshinde55/apache-webserver .

Launch container using own Dockerfile:

docker run -dit --name os1 -p 1234:80 pratikshinde55/apache-webserver:latest

Launch Container

Launch Container

See on Browser with Public_IP of Host : 1234 port number.

If you click on my Social platforms button then it directly go to my Profile of that platform.

Browser-Webpage

Browser-Webpage

Step:4-We can also put custom webpage

Anyone can use this my Custom image because i push this image to Docker Hub, if anyone want use this image with their own webpage deploy.

Then 1st need to create webpage directory in that directory put index.html own webpage then mount volume(-v) during launching the Container.

/usr/local/apache2/htdocs/ — This is default DocumentRoot of official Apache HTTP Server Docker image.

docker run -dit --name webapp -v /root/ps/webpage:/usr/local/apache2/htdocs/ -p 8010:80 pratikshinde55/apache-webserver:latest

Custom Webpage deploy

Custom Webpage deploy

On Browser:

Custom WebPage

Custom WebPage


메타데이터
post_id
be04218146ec
slug
set-up-apache-web-server-inside-docker-container-be04218146ec
url
https://medium.com/@pratikshinde2210/set-up-apache-web-server-inside-docker-container-be04218146ec
canonical_url
https://medium.com/@pratikshinde2210/set-up-apache-web-server-inside-docker-container-be04218146ec
author_url
https://medium.com/@pratikshinde2210
status
ok
fetched_at
2026-06-27 23:56:40