How to create and launch a Dockerfile for Payara Micro

You can also start it by the method introduced in "Run Payara with Docker", but I also want to put the app in the Docker image! I want to be able to start it as much as possible with the same feeling as GlassFish! In that case.

reference: ADAM BIEN'S WEBLOG - PAYARA MICRO AND DOCKER http://www.adam-bien.com/roller/abien/entry/payara_micro_and_docker

The linked video explains how to create it without using the official Payara image. The official image of Payara implements about half of what is explained in the video.

The following is an example of deploying WAR_TO_DEPLOY.war in/ path / to / war /on the local host (boot2docker or DockerMachine) and starting payara.

Description of Dockerfile

Dockerfile


FROM payara/micro

ADD "/path/to/war/WAR_TO_DEPLOY.war" "/tmp/"
ENTRYPOINT java -jar ${PKG_FILE_NAME} --deploy "/tmp/WAR_TO_DEPLOY.war"

I store the war file in / tmp of the Docker container, and deploy and execute it from there. It does not have to be / tmp. Variables etc. can be described as written here.

Build / Start Web Server

$ docker build -t image name.
$ docker run --name container name-p 8080:8080 -p 4848:4848 -p 8009:8009 -p 8181:8181 -d Image name

It is a description when forwarding all ports EXPOSE with payara / micro. In practice, it is enough to specify only the ports you plan to use.

Access web app

Go to http: // localhost: 8080 / WAR_TO_DEPLOY.

(Replace the localhost part with the boot2docker or DockerMachine address as appropriate)

Add settings to Payara Micro domain (optional)

If you need to add settings to your domain, such as when you want to create a connection pool, you also need to do the following:

reference: How do I add JDBC drivers and configure JDBC Resources in Payara Micro? http://stackoverflow.com/questions/32899120/how-do-i-add-jdbc-drivers-and-configure-jdbc-resources-in-payara-micro

Getting and editing microdomain.xml

Microdomain.xml in Payara repository Will be downloaded. It's like domain.xml for Payara Micro. Edit microdomain.xml and save it as if you were editing domain.xml.

You can easily see what to add and where to add it by creating a set of settings in the Payara or GlassFish admin console, then opening domain.xml to see the diffs.

Modify Dockerfile

Make microdomain.xml referenced with the --domainConfig option when payara starts.

Dockerfile


FROM payara/micro

ADD "/path/to/war/WAR_TO_DEPLOY.war" "/tmp/"
ADD "/path/to/resource/microdomain.xml" "/etc/opt/"
ENTRYPOINT java -jar ${PKG_FILE_NAME} --deploy "/tmp/WAR_TO_DEPLOY.war" --domainConfig "/etc/opt/microdomain.xml"

While running, you may see the message ʻException while persisting domain.xml, changes will not be available on server restart.`, but don't worry. There should be almost no situation where Payara "Micro" is restarted ...

Recommended Posts

How to create and launch a Dockerfile for Payara Micro
How to create a database for H2 Database anywhere
How to create pagination for a "kaminari" array
[Docker] How to create a virtual environment for Rails and Nuxt.js apps
How to create a method
[Rails] How to create a signed URL for CloudFront
[Spring Boot] How to create a project (for beginners)
How to create a lightweight container image for Java apps
[Java] How to create a folder
[Basic] How to write a Dockerfile Self-learning ②
[Swift5] How to create a splash screen
[rails] How to create a partial template
How to write and explain Dockerfile, docker-compose
How to create a server executable JAR and WAR with Spring gradle
[Rails] How to create a table, add a column, and change the column type
How to create a convenient method that utilizes generics and functional interfaces
[Rails] How to create a graph using lazy_high_charts
How to create a class that inherits class information
How to create a theme in Liferay 7 / DXP
How to make a lightweight JRE for distribution
[1st] How to create a Spring-MVC framework project
How to easily create a pull-down in Rails
[Rails] How to create a Twitter share button
How to write dockerfile
How to create docker-compose
How to create a Java environment in just 3 seconds
How to use an array for a TreeMap key
How to write a unit test for Spring Boot 2
How to create a JDBC URL (Oracle Database, Thin)
How to create a Spring Boot project in IntelliJ
How to create a data URI (base64) in Java
How to launch another command in a Ruby program
[For those who create portfolios] How to use font-awesome-rails
How to convert A to a and a to A using AND and OR in Java
How to create and execute method, Proc, Method class objects
How to make a mod for Slay the Spire
(Ruby on Rails6) How to create models and tables
How to launch Swagger UI and Swagger Editor in Docker
I want to create a generic annotation for a type
How to create a header or footer once and use it on another page
How to quit Docker for Mac and build a Docker development environment with Ubuntu + Vagrant
Tutorial to create a blog with Rails for beginners Part 1
SDWebImage: How to clear the cache for a particular UIImageView
Java conditional branching: How to create and study switch statements
How to create a form to select a date from the calendar
How to leave a comment
How to create a placeholder part to use in the IN clause
[For those who create portfolios] How to use chart kick
How to use Font Awesome icon for ul and li
How to test a private method with RSpec for yourself
How to output array values without using a for statement
[For those who create portfolios] How to omit character strings
How to develop and register a Sota app in Java
Minecraft Modding [1.12] How to attach a special render for Item
How to join a table without using DBFlute and sql
Tutorial to create a blog with Rails for beginners Part 2
Procedures for passing RealmObject to Fragment and how to use Parceler
How to insert a video
Tutorial to create a blog with Rails for beginners Part 0
How to create a jar file or war file using the jar command
How to use \ t Escape sequences different for mac and Windows-java