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
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.
It is built for current Mule 4 Community Edition Runtime.
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"]
To build and run the application - execute
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 -
It should output -
Hello from Mule ESB (Version: 4.1.0). I am running inside docker image javastreets/mule:latest-4
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