Overview and Scope
This demo post is about containerising Mulesoft Enterprise Edition “mule-ee-distribution”, standalone and using CentOS as base image, adding multiple layers including required java binaries using dockerfile. 30 days trail is used for this demo implementation. The focus will be on containerising and using that image in Harness CI/CD workflow and pipeline using Docker hub for storing image/container.
Harness CI/CD is used to build infrastructure, and configure Application, Services, and Environments, using workflows, pipelines. This post uses, Canary Deployment model, a pattern for rolling out releases to a subset of users or servers. The idea is to first deploy the change to a small subset of servers, test it, and then roll the change out to the rest of the servers.
Prerequisites :-
- Docker desktop for Mac
- Kubernetes – kubectl – https://kubernetes.io/docs/tasks/tools/
- Harness trial account – for building Infrastructure using workflows and pipelines.
- Mulesoft Enterprise edition – Standalone trials from http://www.mulesoft.org
- Java Binaries – AdoptOpenJDK [openjdk8-binaries]
- IDE – VSCode for building dockerfile
- Homebrew – Package Manager for macOS
Dockerize the Mulesoft – Create dockerfile with multiple layers
In order to containerise Mulesoft, we need to have below dependencies in the dockerfile files.
- java binaries are prerequisites,
- CentOs is used as base image,
- Ports are exposed for communication and below are the requirements for this demo post.
Ports Required | Description |
---|---|
PORT 8081-8082, 8091-8092 | Required by the Mule Apps |
PORT 1098 | Mule JMX port (must match config file) |
PORT 5000 | Configuration directory |
PORT 7777 | Required for mule agent |
- Required volume – Mount Points are defined as below
Mount point | Description |
---|---|
/opt/mule/apps | Required for Application deployment directory |
/opt/mule/domains | Required for Domains deployment directory |
/opt/mule/conf | Required for Configuration directory |
/opt/mule/logs | Required for Logs directory |
Docker Image packaging for MuleESB http://www.mulesoft.org

Create a dockerfile that will contain the Mulesoft standalone
FROM centos:latest # Define docker build ARGS ARG JAVA_BINARIES=https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u265-b01/OpenJDK8U-jdk_x64_linux_hotspot_8u265b01.tar.gz ARG RUNTIME_VERSION=4.3.0 # Define environment variables ENV JAVA_BINARIES $JAVA_BINARIES ENV TMP_DIR /tmp/ ENV JAVA_HOME /opt/jdk ENV PATH $JAVA_HOME/bin:${PATH} ENV MULE_ARGS "${MULE_ARGS:-start}" ENV RUNTIME_VERSION $RUNTIME_VERSION ENV MULE_HOME /opt/mule WORKDIR /opt # Install required binaries RUN curl -L ${JAVA_BINARIES} -o jdk.tar.gz && \ mkdir jdk && \ tar xf jdk.tar.gz -C jdk --strip-components 1 && \ rm -rf jdk.tar.gz && \ curl -L http://s3.amazonaws.com/new-mule-artifacts/mule-ee-distribution-standalone-${RUNTIME_VERSION}.tar.gz -O && \ tar xvf mule-ee-distribution-standalone-${RUNTIME_VERSION}.tar.gz && \ rm -rf mule-ee-distribution-standalone-${RUNTIME_VERSION}.tar.gz && \ ln -s /opt/mule-enterprise-standalone-${RUNTIME_VERSION} mule && \ adduser mule && \ chown -R mule:mule /opt/mule-enterprise-standalone-${RUNTIME_VERSION} # Define mount points VOLUME ["/opt/mule/logs", "/opt/mule/conf", "/opt/mule/apps", "/opt/mule/domains","/opt/mule/libs"] # HTTP Service Port # Required by the Mule Apps EXPOSE 8081-8082 EXPOSE 8091-8092 # Mule remote debugger EXPOSE 5000 # Mule agent EXPOSE 7777 # Mule JMX port (match Mule config file) EXPOSE 1098 # Start Mule runtime USER mule #execute the commands CMD [ "/opt/mule/bin/mule", "$MULE_ARGS" ]



In order to save time, I have pushed this image/container on docker hub, this will be used in the Harness CI/CD pipeline in the below following steps.
Setup and Configure Harness CI/CD
Setup and configure Harness CI/CD –
- Install the Harness Delegate
- Connect to your Infrastructure
- Connect to Artifact Repositories [dockerhub is used for this post]
- Configure your Application, Services, and Environments
- Build your Workflows and Pipeline then deploy!





Canary Deployment, we are starting with 30% of the instances.


Deploy
Using Harness CI/CD, we create a new deployment, use the latest tag for the service created above.



Canary Deployment Success- After a few minutes of running, we will see the container image is successfully rolled out.

Next Steps
Mulesoft setup and configuration is a separate post altogether, and it would be part of a following demo post.