Installing Tomee Web Server Through Docker File For Windows Container

Installing Tomee Web Server Through Docker File For Windows Container

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

image_thumb10
  • Click on Agree and Start Free Download to download the file.
image_thumb7

DOWNLOAD JDK SETUP FILE

image11_thumb
  • Click on the jdk8u131_windows-x64.exe link to download the JDK file.
image_thumb3

DOWNLOAD TOMEE

image
  • 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:\

image
  • Now create a new folder named setup under c:\tomee folder.

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

image
  • Create a new file name as dockerfile under c:\tomee folder.

New-Item -Type File -Name dockerfile -Path C:\tomee\

image
  • 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

image
  • Copy the downloaded JDK, JRE & TOMEE setup files in C:\tomee\setup folder.
image
  • Create a new file named jre.cfg in C:\tomee\setup folder.
image
  • 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.
image

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.
image

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″)

image
  • Create a new file named tomeeservice.bat and paste the below content and save it.

cd\
cd .\tomee\bin\
.\service.bat install

image
  • 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

image
  • It will take several minutes to complete the build process.
  • The build completed successfully.
image

VERIFYING THE IMAGE

  • Launch a new container using the below command.

docker run -it tomee powershell

image
  • Once the container is up and running, verify the tomee service status.

Get-Service tomee

image
  • Type ipconfig to find the container IP address.
image
  • Browse the container IP (172.28.239.183) with default port number 8080 from the container host.
image
  • You can download the script files from the GitHub URL.

https://github.com/assistanz247/Tomee

image
  • You can download the pre-built tomee image from the Docker hub URL.

https://hub.docker.com/r/assistanz247/tomee-windows/

image
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.

Loges

Leave a Reply

Your email address will not be published. Required fields are marked *