/other/

Docker postgres & wildfly

2017-09-24 22:12:56

JEE Project

All files for this Example you can find on github

Step 1 - Download necessary images

docker pull postgres:9.6.5
docker pull jboss/wildfly:10.1.0.Final

Step 2 - Create app

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

----------------------------------------------