JRebel with Docker

JRebel remote server functionality is available for virtual machines running on Docker. The following details need to be kept in mind when running JRebel with Docker.

  1. The Docker container needs to include the JRebel Agent and its platform-specific library. You can download the newest JRebel here.

  2. You need to enable JRebel for the application server in Docker. Add -agentpath:/[JRebel library] and -Drebel.remoting_plugin=true to the startup parameters. You will need to replace the library placeholder with the correct operating system and 32 or 64 bit library:

    Windows 64-bit JDK -agentpath:[c:\path\to]jrebel64.dll
    Windows 32-bit JDK -agentpath:[c:\path\to]jrebel32.dll
    Mac OS X 64-bit JDK -agentpath:[path/to]libjrebel64.dylib
    Mac OS X 32-bit JDK -agentpath:[path/to]libjrebel32.dylib
    Linux 64-bit JDK -agentpath:[path/to]libjrebel64.so
    Linux 32-bit JDK -agentpath:[path/to]libjrebel32.so
  3. The JRebel IDE plugin and project need to be configured with the remote server information. You need to enable remote server support for the project and configure the JRebel IDE plugin to connect to the Docker server. For more information, refer to remote server overview.

Tip

Refer to the running servers from command line chapter to learn more about adding JRebel to various application servers.


Example for JRebel with Docker and Tomcat 8.0 (Linux 64-bit)

  1. Download the JRebel archive.

  2. Extract jrebel.jar from the root and libjrebel64.so from the lib folder of the downloaded archive. Copy these files to the folder that you will use to generate the image.

  3. Create a new Dockerfile in the same folder with the following content:

    FROM tomcat:8.0
    COPY jrebel.jar /jrebel.jar
    COPY libjrebel64.so /libjrebel64.so
    ENV JAVA_OPTS="-agentpath:/libjrebel64.so -Drebel.remoting_plugin=true"
    
  4. Save your Dockerfile.

  5. Build your Docker image.

    $ docker build -t [desired image title] .
    
  6. Run your Docker container!

To use remote server functionality, add your Docker server address to your IDE workspace for synchronization.