JEE Project
– http://www.blog.btbw.pl/java/jee-and-flywaydb-wildfly-10-1-0-final/
– https://github.com/szalek/JEE-Hibernate-Deltaspike-Flywaydb
All files for this Example you can find on github
– https://github.com/szalek/Docker/tree/master/szalek_wildfly_postgres
Step 1 – Download necessary images
docker pull postgres:9.6.5 docker pull jboss/wildfly:10.1.0.Final
Step 2 – Create app
– http://www.blog.btbw.pl/java/jee-and-flywaydb-wildfly-10-1-0-final/
Step 3 – Extend wildfly image. Add app & configuration
Dockerfile
FROM jboss/wildfly:10.1.0.Final COPY ./wildfly-10.1.0.Final/modules/system/layers/base/org/postgresql/ /opt/jboss/wildfly/modules/system/layers/base/org/postgresql/ COPY ./wildfly-10.1.0.Final/standalone/configuration/standalone.xml /opt/jboss/wildfly/standalone/configuration/standalone.xml COPY ./jee-hibernate-deltaspike-flywaydb.war /opt/jboss/wildfly/standalone/deployments
Build new image
docker build -t szalek/wildfly:1.0 .
Step 4 – Run Docker with postgres
docker run --name my-postgres -v /$(pwd)/_tmp_data:/var/lib/postgresql/data -e POSTGRES_PASSWORD=postgres -d postgres:9.6.5
Step 5 – Run Docker with app
docker run --name my-wildfly --link my-postgres:postgres -d -p 8080:8080 szalek/wildfly:1.0
Summary
https://hub.docker.com/_/postgres/ https://hub.docker.com/r/jboss/wildfly/ docker pull postgres:9.6.5 docker pull jboss/wildfly:10.1.0.Final docker run --name my-postgres -v /$(pwd)/_tmp_data:/var/lib/postgresql/data -e POSTGRES_PASSWORD=postgres -d postgres:9.6.5 # docker run --name my-wildfly --link my-postgres:postgres -d -p 8080:8080 jboss/wildfly:10.1.0.Final # docker exec -ti my-wildfly /bin/bash ---------------------------------------------- docker build -t szalek/wildfly:1.0 . docker run --name my-wildfly --link my-postgres:postgres -d -p 8080:8080 szalek/wildfly:1.0 ----------------------------------------------