×
Installing Apache Web Server through Docker File For Windows Container
Blog Containers

Installing Apache Web Server through Docker File For Windows Container

Installing Apache Web Server through Docker File For Windows Container

In this blog, we will show you Installing Apache Web Server through Docker File For Windows Container on windows 2016 container host.

 

REQUIREMENTS

  • Windows container host with docker service installed
  • Base windows server core image
  • Apache web server installation file

 

DOWNLOAD APACHE WEB SERVER

Installing Apache Web Server through Docker File

 

  • Download the latest modified apache web server setup file.

Installing Apache Web Server through Docker File

 

PREPARING FOR APACHE INSTALLATION

  • Create a new folder named apache on c:\ drive on windows container host machine using below command.

New-Item -ItemType Directory -Path c: -name apache

Installing Apache Web Server through Docker File

 

  • create a new folder named setup under apache on c:\drive using below command.

New-Item -Type Directory -Path C:\apache\ -Name setup

Installing Apache Web Server through Docker File

 

  • Copy the downloaded apache setup file to c:\apache\setup folder.

Installing Apache Web Server through Docker File

 

CREATING DOCKER FILE

  • Create a file named dockerfile on c:\apache folder using below command.

New-Item -Type file -Path c:\apache -name dockerfile

Installing Apache Web Server through Docker File

 

  • Add the below coding in the dockerfile and save it.

#THIS DOCKER FILE IS DEVELOPED BY ASSISTANZ NETWORKS

#SPECIFY THE CONTAINER IMAGE
FROM microsoft/windowsservercore

#COPY THE APACHE INSTALLATION FILES INTO THE CONTAINER
ADD ./setup c:/apache

#INSTALLING APACHE
RUN [“msiexec.exe”, “/i”, “C:\\apache\\apache_2.2.8-win32-x86-no_ssl.msi”, “/qn”]

#APACHE CONFIGURATION

RUN powershell.exe -command \

#COPY CUSTOMIZE HTTPD CONFIGURTION FILE TO APACHE conf FOLDER
copy-item c:/apache/httpd.conf -destination ‘”c:/program files (x86)/Apache Software Foundation/Apache2.2/conf”‘; \

#INSTALLING APACHE SERVICE USING BATCH FILE
cmd.exe /c c:/apache/service.bat; \

#SET APACHE SERVICE TO RUN UNDER LOCAL SYSTEM ACCOUNT
sc.exe config apache2.2 obj=LocalSystem; \

#REMOVE THE APACHE SETUP FILES DIRECTORY
remove-item c:/apache -Recurse

 

Installing Apache Web Server through Docker File

 

Installing Apache Web Server through Docker File

 

Installing Apache Web Server through Docker File

 

  • Copy these two files httpd.conf & service.bat in c:\apache\setup folder.

Installing Apache Web Server through Docker File

 

  • Now everything is set to start the installation.

 

INSTALLING APACHE ON WINDOWS CONTAINER

  • Open PowerShell window and execute the below command to build the apache container image using docker file.

docker build -t apache c:\apache

Installing Apache Web Server through Docker File

 

  • It will take few minutes to complete the building process.

Installing Apache Web Server through Docker File

 

VERIFY THE BUILT IMAGE

  • From the PowerShell window, type docker images command to verify the available images in the container host.

Installing Apache Web Server through Docker File

 

  • Run the below command to launch a container using the built image.

docker run -it -p 80:80 apache powershell

Installing Apache Web Server through Docker File

 

  • Once the container is online, we can verify the apache service status.

Installing Apache Web Server through Docker File

 

  • Access the container using the container host IP from outside VM.

Note: In this demo, our container host IP is 192.168.232.80

Installing Apache Web Server through Docker File

 

  • Also, we can able to access the apache web page using the container IP from the container host.

Installing Apache Web Server through Docker File

 

VIDEO:

Thanks for reading this blog. We hope it was useful for you to learn how to install apache on windows container.

4 thoughts on “Installing Apache Web Server through Docker File For Windows Container”

  1. i would like to know installing tomee and jenkins on windows container.i appriciate the help.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.