How to start a Docker image of WildFly with an application deployed

User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

Serving a Docker container with a non default image of WildFly is pretty easy. Say that you have a folder named build with an application demoapp.war deployed on it. Then you can create a Dockerfile which merely adds the Web application to the deployments folder of your server. Then use the CMD command to start WildFly with the required configuration and bindings:

FROM jboss/wildfly
ADD build/demoapp.war "/opt/jboss/wildfly-10.0.0.Final/standalone/deployments/demoapp.war"
# Start WildFly using the HA Profile
CMD ["/opt/jboss/wildfly-10.0.0.Final/bin/standalone.sh", "-c","standalone-ha.xml","-b", "0.0.0.0","-bmanagement","0.0.0.0"]

Build your image with a meaningful tag name:

$ sudo docker build --rm -t jboss/wildfly/custom .

Once the image has completed building, you can run it. In order to run the image, you will need to reference it by its name, which in our case is jboss/wildfly/custom:

$ sudo docker run -it jboss/wildfly/custom

 


Advertisement