How to run a wildfly server inside docker
Before we begin you must configure docker, I am using Ubuntu so I followed the guide here: https://docs.docker.com/engine/installation/linux...
https://www.czetsuyatech.com/2016/12/wildfly-run-inside-docker.html
Before we begin you must configure docker, I am using Ubuntu so I followed the guide here: https://docs.docker.com/engine/installation/linux/ubuntulinux/. Choose the appropriate OS that applies to you.
Let's do this in sequence:
-from is a docker keyword use to import an image from docker hub hub.docker.com
-run is a command that runs an executable file, in this case we are adding a user with application management role
-add lets us add a file inside the container
-cmd tells the docker to execute this by default, when we execute docker run
Let's do this in sequence:
- Checkout and compile the very basic javaee war from https://github.com/czetsuya/hello-javaee.
- In Ubuntu create a new folder: wildfly-hello:
>mkdir wildfly-hello - Copy hello-javaee.war inside wildfly-hello.
- Create a Dockerfile and insert the lines below inside the same folder.
from jboss/wildfly run /opt/jboss/wildfly/bin/add-user.sh admin admin@1234 --silent add hello-javaee.war /opt/jboss/wildfly/standalone/deployments/ cmd ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"]
- Inside the wildfly-hello folder build the Dockerfile.
>docker build -it wildfly-hello . - Run the docker image
>docker run wildfly-hello - Get the ip address of the container by:
>docker ps - to get the container id
>docker inspect -f '{{ .NetworkSettings.IPAddress }}' CONTAINER_ID - Now we should have the ip address of docker, we can now open wildfly in the browser.
-from is a docker keyword use to import an image from docker hub hub.docker.com
-run is a command that runs an executable file, in this case we are adding a user with application management role
-add lets us add a file inside the container
-cmd tells the docker to execute this by default, when we execute docker run
Post a Comment