Dockerise the Application

We use Gradle and Dockerizor to build the application. Instead of running the sample within the Eclipse IDE you can build a Docker image:

$ ./gradlew dockerize
This recipe assumes you have a local RabbitMQ up and running.

Let’s create an isolated network recipe_nw to test the complete recipe:

docker network create -d bridge --subnet recipe_nw

To start a temporary RabbitMQ container inside this network issue the following command:

$ docker run --rm -it --net=recipe_nw --name rabbitmq rabbitmq:3.6.2

then run the application with the environment variable set to the container name used in the command above:

$ docker run --rm -it --net=recipe_nw --publish 8080 -e virgo-recipe/{guide-short-name}-app