DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Deploying a Scalable Golang Application on Kubernetes: A Practical Guide
  • Serverless vs Containers: Choosing the Right Architecture for Your Application
  • Have You Heard About Cloud Native Buildpacks?
  • Setting Up Local Kafka Container for Spring Boot Application

Trending

  • The 7 Pillars of Meeting Design: Transforming Expensive Conversations into Decision Assets
  • Monitoring Spring Boot Applications with Prometheus and Grafana
  • Working With Cowork: Don’t Be Confused
  • Modernization Is Not Migration
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Dockerizing Mule Application

Dockerizing Mule Application

This article contains the step by step information on how to Dockerize MuleSoft Application. Read on for the tutorial!

By 
Ankit Lawaniya user avatar
Ankit Lawaniya
·
Oct. 13, 20 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
10.5K Views

Join the DZone community and get the full member experience.

Join For Free

Dockerizing Mule Application

This article contains the step by step information on how to Dockerize MuleSoft Application. Here we will create a Docker image containing Mule Standalone server 3.9.4. As soon as our image is built, we will run the container to start the application.

As we can see in the Dockerfile, we have picked centos as our base image and installing the JDK 1.8, Maven, and Mule Standalone runtime on it. Once the environment setup is done then it's copying the application zip file into the apps folder of Mule_HOME.

Note: We have exposed port 8080 as our application port.

Step 1: Include the Dockerfile inside your application root directory.

Dockerfile
 




x


 
1
FROM centos
2

          
3
ENV MULE_HOME /opt/mule
4
ENV MULE_VERSION 3.9.4
5

          
6
# yum install JDK,Maven and MuleStandalone runtime
7
RUN yum update -y \
8
   && yum install -y java-1.8.0-openjdk-devel maven zip \
9
   && yum clean all -y \
10
   && cd /opt \
11
   && curl -k -o mule-3.9.4.zip http://s3.amazonaws.com/new-mule-artifacts/mule-ee-distribution-standalone-3.9.4-hf1.zip  \
12
   && unzip mule-3.9.4.zip \
13
   && mv mule-enterprise-standalone-$MULE_VERSION-hf1 mule
14

          
15
# Copy application files
16
COPY ./target/*.zip $MULE_HOME/apps/
17

          
18
# EXPOSED Application Port
19
EXPOSE 8080
20

          
21
ENTRYPOINT /opt/mule/bin/mule
22

          
23

          



Step 2: Build the Dockerfile to create an image, We are using "docker build" command for the same. Commands and Instructions given in the Dockerfile will be executed in order and for each instruction separate layer will be created since Docker follows the layered architecture.

Note: Run this command in your root application folder.

Shell
 




xxxxxxxxxx
1


 
1
docker build -t alawaniy/mule-dockerization .



Step 3 (Optional) : Once docker image is created we can push the image to Docker Hub Private Repository which can be shared across teams.

Note: You must have to login before pushing an image to Docker Hub.

Shell
 




xxxxxxxxxx
1


 
1
docker push alawaniy/mule-dockerization



Step 4: Run the image using the below command which will basically start the container but internally this will start the Mule Standalone server and your copied application will be deployed to the Server.

Shell
 




xxxxxxxxxx
1


 
1
docker run -it -p 8080:8080 alawaniy/mule-dockerization



Step 5: Test the Application by hitting the URL on the browser.

Note: My application is running on port 8080.

mule containers

Hope this helps!

Thanks.

Keep learning.

application Docker (software)

Opinions expressed by DZone contributors are their own.

Related

  • Deploying a Scalable Golang Application on Kubernetes: A Practical Guide
  • Serverless vs Containers: Choosing the Right Architecture for Your Application
  • Have You Heard About Cloud Native Buildpacks?
  • Setting Up Local Kafka Container for Spring Boot Application

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook