Log out?

Dockerizing the eiPlatform

Dockerizing the eiPlatform

Overview

Docker is a container technology that allows for the packaging of an application along with its dependencies and related configuration to allow for simple cross-platform and cross-environment deployments. As the PilotFish eiPlatform promotes configuration over code, it is well-suited for container environments. eiPlatform docker images can be easily defined and utilized for rapid Interface development, testing, deployment and ongoing maintenance. The instructions below demonstrate how to build a basic eiPlatform docker image and then run a container off of it. There are many further tweaks possible to customize and refine the created image however the examples below are aimed at the basic use-case.

Container Facilities of the eiPlatform

Several new facilities have been added to the software to allow it to operate better in container environments. One of the most visible is the ability to set the eiPlatform’s core configuration settings via system environment variables which allows for configuration settings to be defined at container build and/or run time. All eipServer.conf settings that are shipped with the product define an associated, distinctive system environment variable that can be used to set the core values, ie:

Additional settings can also be added to the shipped settings following the same system environment variable convention if so desired.

Instructions

  1. Install docker locally (link to instructions)

    You will need docker installed on the host that you will be building the image and/or running the container(s) on.

  2. Assemble components of build context

    The docker build context can generally be thought of the files to be applied on top of the base image defined in the FROM Dockerfile declaration. For the eiPlatform this will be:

  3. Define the Dockerfile

    The basic eiPlatform Dockerfile is quite simple, here we are using an image that includes Tomcat 8.5 with JRE 8 on top of Alpine Linux:

    FROM tomcat:8.5-jre8-alpine
    
    # Set JVM memory
    ENV JAVA_OPTS="-Xms1g -Xmx3g"
    
    # Set eip-root config setting
    ENV PFISH_EIP_CONF_com_pilotfish_eip_configDirectory="/opt/pilotfish/eip-root"
    
    # Copy Working Directory contents
    COPY eip-root /opt/pilotfish/eip-root
    
    # Copy custom tomcat context.xml, see file for changes
    COPY eip.tomcat.context.xml /usr/local/tomcat/conf/context.xml
    
    # Copy in war file
    COPY eip.18R1.99.war /usr/local/tomcat/webapps/eip.war
    

  4. Build the docker image

    Once the Dockerfile and build context are in place, its time to build the image (note the period at the end):

    docker build --tag eip:18R1 .

    • You should see the docker build the image.
      • If this is the first run you will notice it pulling down the base image layers from Docker Hub.
    • This command will also tag the image as ‘eip:18R1’.
      • Other tag naming conventions can be used to suit your individual use-cases and needs.
  5. Run a docker container from the image

    Now that you have the image, its time to run a container from it. Docker ‘containers’ are running instances of an image.

    docker run -it --rm --name eip1 -p 8181:8080 eip:18R1

    The `docker run` options and switches are described on Docker’s website,  here we are using the following:

    • -it – i=interactive, t=allocate a pseudo-tty (commonly used to start a docker on your local system, will allow things such as Ctrl-c to exit container)
    • --rm – Automatically remove container when it exits
    • --name – Name to give running container, though not required makes subsequent management with container easier
    • -p 8181:8080 – Publish container’s port 8080 as 8181 on the host system
    • eip:18R1 – Tag of image we want to run a container for

You will now see the container start up and extract the eip.war file contents, at the end you should see a message indicating ‘org.apache.catalina.startup.Catalina.start Server startup in nnnn ms’ which indicates the application container has finished loading.

Testing the Running Container

Further Enhancements and Customization

As indicated in the Overview section, the instructions presented are meant to stand up a basic eiPlatform docker instance. There are several areas where additional configuration and options can be introduced to better customize the end result, here are a couple common ones:

A Word On Licensing and Restrictions

This is a unique website which will require a more modern browser to work! Please upgrade today!

Thanks!

Our editors are notified.

Close