![Installing Tomee Web Server Through Docker File For Windows Container](https://blog.assistanz.com/wp-content/uploads/2023/09/image-503.png)
Installing Tomee Web Server through Docker File For Windows Container
In this blog, we will show you installing tomee web server through docker file for Windows container
REQUIREMENTS
- Windows container host with Docker service installed.
- Base windows server core image.
- JAVA & TOMEE Installation files.
DOWNLOAD JRE SETUP FILE
- Go to the URL https://www.java.com/en/download/windows-64bit.jsp
- Click on Agree and Start Free Download to download the file.
DOWNLOAD JDK SETUP FILE
- Click on the jdk8u131_windows-x64.exe link to download the JDK file.
DOWNLOAD TOMEE
- Go to the URL http://tomee.apache.org/downloads.html and download the latest version.
- Extract the downloaded zip to a folder named tomee
PREPARING THE ENVIRONMENT FOR BUILDING TOMEE CONTAINER IMAGE
- Create a new folder named tomee under c:\ drive using below command.
New-Item -Type Directory -Name tomee -Path c:\
- Now create a new folder named setup under c:\tomee folder.
New-Item -Type Directory -Name setup -Path C:\tomee\
- Create a new file name as dockerfile under c:\tomee folder.
New-Item -Type File -Name dockerfile -Path C:\tomee\
- Open the file dockerfile in notepad and paste the below content.
# THIS DOCKER FILE WAS DEVELOPED BY ASSISTANZ NETWORKS
# SPECIFY THE CONTAINER IMAGE
FROM microsoft/windowsservercore
# COPY THE TOMEE INSTALLATION FILES INTO THE CONTAINER
ADD ./setup c:/source
RUN powershell.exe -command \
# INSTALLING JAVA JRE
./source/jre.cmd; \
# INSTALLING JAVA JDK
./source/jdk.cmd; \
# COPYING TOMEE SETUP FILES TO C Drive
Copy-Item c:/source/tomee -Destination c:/tomee -Recurse; \
# SETTING UP ENVIRONMENT PATH VARIABLES FOR JRE & JDK FOLDERS
./source/Environmentvariable.ps1; \
# Installing Tomee service
cmd.exe /c c:/source/tomeeservice.bat; \
# SET TOMEE SERVICE TO RUN UNDER LOCAL SYSTEM ACCOUNT
sc.exe config tomee obj=LocalSystem start=auto; \
# REMOVE TOMEE SETUP FILES FROM SOURCE DIRECTORY
cmd.exe /c rd /S /Q c:\source
- Copy the downloaded JDK, JRE & TOMEE setup files in C:\tomee\setup folder.
- Create a new file named jre.cfg in C:\tomee\setup folder.
- Add the below content in jre.cfg file and save it.
INSTALL_SILENT=Enable
SPONSORS=Disable
NOSTARTMENU=Enable
REBOOT=Disable
EULA=Disable
AUTO_UPDATE=Disable
STATIC=Enable
- Create a new file named jre.cmd and add the below content and save it.
pushd %~dp0
start /wait jre-8u131-windows-x64.exe INSTALLCFG=%~dp0jre.cfg
- Create a new file named jdk.cmd and add the below content and save it.
pushd %~dp0
start /wait jdk-8u131-windows-x64.exe INSTALLCFG=%~dp0jre.cfg
- Create a new file named Environmentvariable.ps1 and add the below content and save it.
[Environment]::SetEnvironmentVariable(“JRE_HOME”,”C:/Program Files/Java/jre1.8.0_131″)
[Environment]::SetEnvironmentVariable(“JAVA_HOME”,”C:/Program Files/Java/jdk1.8.0_131″)
- Create a new file named tomeeservice.bat and paste the below content and save it.
cd\
cd .\tomee\bin\
.\service.bat install
- We have completed the preparation part for tomee image deployment.
BUILDING THE IMAGE
- Go to PowerShell window and execute the below command.
docker build -t tomee c:\tomee
- It will take several minutes to complete the build process.
- The build completed successfully.
VERIFYING THE IMAGE
- Launch a new container using the below command.
docker run -it tomee powershell
- Once the container is up and running, verify the tomee service status.
Get-Service tomee
- Type ipconfig to find the container IP address.
- Browse the container IP (172.28.239.183) with default port number 8080 from the container host.
- You can download the script files from the GitHub URL.
https://github.com/assistanz247/Tomee
- You can download the pre-built tomee image from the Docker hub URL.
https://hub.docker.com/r/assistanz247/tomee-windows/
VIDEO
Thanks for reading this blog. We hope it was useful for you to learn how to build tomee web server container image using docker file.
![](https://blog.assistanz.com/wp-content/uploads/2023/09/image-504.png)
Loges