Hello dear programmers,
I\'m looking into setting up my development with docker containers since I\'m currently working on windows, my setup is now as follows:
Here is how I have solved the issue you are rising:
maven
to copy the war to the a directory named docker
located under my project web-app. docker
directory contains the Dockerfile
for building the Docker image In the Docker file I copy the packaged war file to the docker image, create a management user to access the administration console on port 9990
and load JBoss
Dockerfile content:
FROM jboss/wildfly
MAINTAINER e.dahari@company.com
ADD your-awesome-app.war /opt/jboss/wildfly/standalone/deployments/
RUN /opt/jboss/wildfly/bin/add-user.sh admin Admin#70365 --silent
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"]
Now you need to create a settings file container_settings.json
. This file contains the parameters to run the Docker image you have built:
{
"_comment" : "My service",
"Image": "your-awesome-app-name",
"HostConfig": {
"PortBindings":{
"9990/tcp": [{ "HostIp": "0.0.0.0", "HostPort": "9990" }]
},
"RestartPolicy": { "Name": "on-failure", "MaximumRetryCount": 5 }
}
Run/Debug Configurations
and add a new Docker Deployment
as described herecontainer_settings.json
should be placed at Container settings
field in the UIPlease note that after building your Docker image for the first time, successive configuration runs are much faster since Docker caches image changes.
Since the only change in your Docker image is the war file, the next configuration runs will only transfer this part of the image.
In general it is important to put the most changing component last in the Docker file as each action in the Docker file is cached.
Hope I have managed to help.