Change JAVA Version in WSO2 Enterprise Integrator Docker image

Asara kumarasena
3 min readOct 12, 2020

WSO2 offers Dockerfiles and init scripts for Ubuntu, CentOS, and Alpine as Open Source artifacts. Furthermore, Docker images (which are built using the above Dockerfiles) are available on the WSO2 Docker Registry and dockerhub to be pulled directly.

WSO2 products need a JDK implementation to be run. The supported JDKs can be found at the documentation on compatibility. For Docker images, this can be a JDK copied from outside, or a JDK already present in the parent image.

Hereby it explains how simple is to point to a different JDK version from outside the parent docker image.

Step 1

Pull the wso2 docker image from dockerhub or wso2 docker repositories. Here I’m testing WSO2 EI 6.4.0.

Step 2

Let’s check the current java version inside the docker image and download a different java version. Here I’m downloading the AdoptOpenJDK jdk8u265-b01 version.

java -version

It will show something similar to below.

Step 3

. Create a folder(ex:-docker) in your local file system to keep the docker file and JDK file.

. Create another folder as files inside the parent folder(docker).

. Copy the extracted JDK folder (jdk8u265-b01) into the newly created folder(files).

Step 4

Let’s Create a new text file inside the parent folder(docker) as below.

#change name of the pulled wso2ei-6.4 docker image
FROM wso2ei-base:6.4.0

ARG USER_HOME=/home/${USER}

# set dependant files directory
ARG FILES=./files

# set jdk configurations
ARG JDK_DIST=jdk8u265*
ARG JAVA_HOME=${USER_HOME}/java

# copy wso2 product distribution to user's home directory
COPY --chown=wso2carbon:wso2 ${FILES}/${JDK_DIST} ${JAVA_HOME}

# set environment variables
ENV JAVA_HOME=${JAVA_HOME} \
PATH=$JAVA_HOME/bin:$PATH

You only have to change the name of the wso2ei-6.4 docker image which was pulled recently and save it as dockerfile. So, Our new image will be based on the existing EI docker image and it should contain all the necessary dependencies that we would need to run any Java application.

The final folder structure should be like this.

Step 5

Then you have to build the docker image.

So go to the file location via terminal where new dockerfile exists and run the below command.

sudo docker build -t sample_docker_image .

Step 6

Run the newly built Docker image by using the below command. You can give a name(ex:- container)to the image before running it.

sudo docker run -it -p 8280:8280 -p 8243:8243 -p 9443:9443 --name integrator sample_docker_image

Step 7

Use the below command to log in to the container.

sudo docker exec -it integrator bash

Step 8

In the final stage, Check the new java version as we did already in step 2.

OK. That’s it! 😃

--

--

Asara kumarasena

Graduate Student @Wayne State University | Former Software Engineer @WSO2