Entity view (Content)

Dockerizing Mule ESB

By bfattouh
Dec. 5, 2014


How many of you as developers have been involved in projects where the need of a Development environment was required during the development process while a Test environment was required for the testing purposes along with a separate clean environment for Production. Different tools have been introduced to build such environments using virtualization to help developers ship applications as fast as possible and simplify the system admins and devops tasks.

In this context, I found Docker a very interesting tool that is easy to use and it greatly simplifies the process of environments setup and thus separate the application development process from the infrastructure aspect Ref[1].


How it works?

To start using Docker we need to have it installed, follow the steps as described in Ref[2] to install it.

To understand what's Docker is all about and have a flaviour of how it works, let's run some example commands. Basically, Docker allows running applications inside a container with a single command: docker run.

Type in the following commands assuming Docker has been already installed:

boot2docker init

boot2docker start

The following illustrates the commands output results:

start docker

As an example, to have an ubuntu container up an running, invoke the following command:

docker run --it ubuntu bash

This command launches a container with ubuntu OS as follows:

start ubuntu container


The command decription:

docker run : runs the container.

ubuntu : the ubuntu OS image, that is the source of the container we run.

Docker first looks for the image in the Docker host, if it is not found then it will be downloaded from the Docker Hub.

-t : flag that assigns a terminal inside our running container.

-i : flag that makes the STDIN available for an interactive connection.

bash: the command that launches a bash shell inside the runnung container.

Build Mule ESB container

As a MuleSoft developer, I need to run different instances of Mule ESB, to achieve this we need to build a mule image using the Dockerfile script available here Ref[3]. This script can be easily converted to build a docker image with the most recent mule version.

For more details on how to build an image using Docker, read the Dockerfile reference available here Ref[4].

The Dockerfile containg the script that builds the image must be saved with Mule ESB enterpise edition in a folder as the following:



To build and tag Mule Docker image run the following command:

docker build --tag=”mule-ee” .

At the end when the image build is successful, run a test by starting a Mule ESB Enterprise instance as follow:

docker run -t -i --name='mule-ee-instance1' mule-ee


The following illustrates the running containers using the command docker ps:


This whows that there is only one running container with ID: d63b0edb4302 using the built image my-mule-app-image.



Ref[1]: http://docs.docker.com

Ref[2]: http://docs.docker.com/installation/#installation

Ref[3]: https://github.com/cpoepke/docker/blob/master/mule-ee/Dockerfile

Ref[4]: http://docs.docker.com/reference/builder/





Post Tags: