VOOZH about

URL: https://www.javacodegeeks.com/2015/03/deploy-to-wildfly-and-docker-from-eclipse.html

⇱ Deploy to WildFly and Docker from Eclipse - Java Code Geeks


Docker and WildFly Part 1 – Deployment via Volumes and Docker and WildFly Part 2 – Deployment over Management API shows two approaches of how JBoss Tools can be configured to run any application on WildFly server running as a Docker container.

The blogs provide detailed setup and the underlying background. This Tech Tip will provide a quick summary of how to deploy a Java EE 7 application to WildFly and Docker from Eclipse.

Lets get started!

Configure Docker

  1. Configure Docker on your machine using Docker Machine.
  2. Find the IP address as:
    docker-machine ip

    and add an entry in /etc/hosts as:

    192.168.99.101 dockerhost

Deployment to WildFly Container using Docker Volumes

  1. Create a folder that will be mounted as volume in the WildFly Docker container. In this case, the folder is /Users/arungupta/tmp/deployments.WildFly Docker container can be started as:
    docker run -it -p 8080:8080 -v /Users/arungupta
    /tmp/deployments:/opt/jboss/wildfly/standalone/deployments/:rw jboss/wildfly

    rw ensures that the Docker container can write to it.

  2. Create a new server adapter:
    πŸ‘ techtip79-wildfly-server
  3. Assign or create a WildFly 8.x runtime:
    πŸ‘ techtip79-wildfly-server-adapter
    Changed properties are highlighted.
  4. Setup the server properties as:
    πŸ‘ techtip-wildfly-server-configuration-1024x491
    Changed properties are highlighted. The two properties on the left are automatically propagated from the previous dialog. Additional two properties on the right side are required to disable to keep deployment scanners in sync with the server.
  5. Specify a custom deployment folder on Deployment tab of Server Editor:
    πŸ‘ techtip79-wildfly-deployment-properties-1024x593
  6. Right-click on the newly created server adapter and click β€œStart”.
    πŸ‘ techtip79-wildfly-server-started-synchronized

    Status quickly changes to β€œStarted, Synchronized” as shown.
  7. Open up any Java EE 7 project (for example javaee7-simple-sample), right-click, Run on Server, and chose this server. The project runs and displays the page:
    πŸ‘ techtip79-javaee7-output-1024x346

Deployment to WildFly Container using Management API

  1. Run WildFly management image as:
    docker run -it -p 8080:8080 -p 9990:9990 arungupta/wildfly-management

    This is only a convenience image to reduce the number of steps required to get started. Dockerfile for this image has more details, including admin credentials.

    Volume mapping is not required in this case, instead additional management port is exposed.

  2. Configure a remote server controlled by management operations:
    πŸ‘ techtip79-wildflyserver-management-operations
    Changed properties are highlighted.
  3. Take the defaults:
    πŸ‘ techtip79-remote-system-integration-1024x418
  4. Set up server properties by specifying the admin credentials (Admin#70365). Note, you need to delete the existing password and use this instead:
    πŸ‘ techtip79-remote-login-credentials
  5. Right-click on the newly created server adapter and click β€œStart”.Status quickly changes to β€œStarted, Synchronized” as shown.
    πŸ‘ techtip79-wildfly-server-started-synchronized
  6. Open up any Java EE 7 project (for example javaee7-simple-sample), right-click, Run on Server, and chose this server. The project runs and displays the page:
    πŸ‘ techtip79-javaee7-output-1024x346

Enjoy!

This blog showed how how to deploy a Java EE 7 application to WildFly and Docker from Eclipse. Is there any other way that you deploy to WildFly Docker container from Eclipse?

Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy

Thank you!

We will contact you soon.

πŸ‘ Photo of Arun Gupta
Arun Gupta
March 13th, 2015Last Updated: March 12th, 2015
0 646 2 minutes read

Arun Gupta

Arun is a technology enthusiast, avid runner, author of a best-selling book, globe trotter, a community guy, Java Champion, JavaOne Rockstar, JUG Leader, Minecraft Modder, Devoxx4Kids-er, and a Red Hatter.
Subscribe

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Back to top button
Close
wpDiscuz