Manik Magar
Posted on February 19, 2018
Recently I updated javastreets/mule docker image to Mule ESB 4.1.0 Community version. In this post, we will run a Hello Mule 4 application in Docker container.
Table of Contents
- 1. What is Mule Docker Image?
- 2. Say Hello Mule 4 Application
- 3. Dockerfile
- 4. Build and Run
- 5. Conclusion
1. What is a Mule Docker Image?
If you are looking for Mule Docker image, then you can check javastreets/mule docker images on docker hub. It is probably the smallest and compact Mule ESB Image.
If you have Docker installed on your machine, you can pull the image as docker pull javastreets/mule
.
2. Say Hello Mule 4 Application
I have added a Simple Hello Mule 4 application to mule4-examples repository on github. This application has only one HTTP listener flow that listens on http://localhost:8081/test/hello.
It is built for current Mule 4 Community Edition Runtime.
3. Dockerfile
The Dockerfile to build and package our application to mule -
FROM javastreets/mule:latest-4
COPY ./target/say-hello-mule4-docker*.jar /opt/mule/apps/
CMD ["/opt/mule/bin/mule"]
4. Build and Run
To build and run the application - execute sh buildAndRun.sh
.
This performs 3 steps -
- Run Maven Build to package application.
- Build Docker image named hellomule4 and adds this application to Mule within docker.
- Starts the docker container to run mule in foreground. (press CTRL+C to stop mule)
To run application in background, you may also run below command -
docker run -d --name hellomule4 -p 8081:8081 hellomule4
This docker image exposes 8081 port and binds it to the 8081 of localhost.
Once application is running, access below url to see Hello from Mule -
http://localhost:8081/test/hello
It should output -
Hello from Mule ESB (Version: 4.1.0). I am running inside docker image javastreets/mule:latest-4
5. Conclusion
It is easy to run Mule Applications inside Docker Containers. javastreet/mule docker image provides an easy way to get Mule Up and Kicking! Example source code is available on Github here - mule4-examples
Posted on February 19, 2018
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.