Deploy to WildFly and Docker from Eclipse – Tech Tip #79

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:
    and add an entry in /etc/hosts as:

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:
    rw ensures that the Docker container can write to it.
  2. Create a new server adapter:
    WildFly Docker Server Adapter
  3. Assign or create a WildFly 8.x runtime:

    Docker WildFly Server Adapter

    Changed properties are highlighted.

  4. Setup the server properties as:

    Docker WildFly Adapter Properties

     

    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:

    Docker WildFly Server Adapter

  6. Right-click on the newly created server adapter and click “Start”.

    Docker WildFly Server 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:

    Docker Java EE 7 Output

 

Deployment to WildFly Container using Management API

  1. Run WildFly management image as:
    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:Docker WildFly Remote Server Configuration

    Changed properties are highlighted.

  3. Take the defaults:

    Docker WildFly Remote System Integration

  4. Set up server properties by specifying the admin credentials (Admin#70365). Note, you need to delete the existing password and use this instead:

    Docker WildFly Admin Credentials

  5. Right-click on the newly created server adapter and click “Start”.Status quickly changes to “Started, Synchronized” as shown.

    Docker WildFly Server 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:

    Docker Java EE 7 Output

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?

Be Sociable, Share!
  • Tweet

13 thoughts on “Deploy to WildFly and Docker from Eclipse – Tech Tip #79

  1. Pingback: 9 Docker recipes for Java EE Applications | Ceiba3D Studio
  2. Pingback: 9 Docker recipes for Java EE Applications | Indie Game Developer!
  3. Pingback: 9 Docker Recipes for Java EE Applications | Voxxed
  4. i tried creating the container just like you, using volume on the deployments dir and the container crashes

    ]): java.lang.IllegalArgumentException: WFLYDS0024: /opt/jboss/wildfly/standalone/deployments is not writable

    yes.. i added :rw .

  5. If you run on MacOSX or Linux, what about checking the access permissions of the docker daemon on the mounted volume ?
    A few more information such as the OS and the values passed into the wizards would help.

  6. FYI. I had the same issue today on OSX: WFLYDS0024: /opt/jboss/wildfly/standalone/deployments

    Problem was that I mapped to my host /tmp/deployments directory which is not part of the VirtualBox Docker instance Shared folders. The Shared Folders does include /Users so mapping using -v /Users/pdv/Downloads/deployments:/opt/jboss/wildfly/standalone/deployments/:rw solved this issue.

  7. Running on Ubuntu 15.04 , I’m facing the error :

    ]): java.lang.IllegalArgumentException: WFLYDS0024: /opt/jboss/wildfly/standalone/deployments is not writable

    A Git issue is open here https://github.com/redhat-developer/docker-java/issues/4#issuecomment-148553560

  8. Pingback: Containers on Strings - Puppetizing Docker - Cambridge Technology Partners Blog
  9. Great article!!! I really was searching for this, I like a lot the development over Docker and I wanna make easy the development via Eclipse. I will implement the post and I will give the feedback soon.

    Great article Arun

Leave a Reply

Your email address will not be published. Required fields are marked *