Over a million developers have joined DZone.

Deploying Spring Boot Applications to Bluemix

Just 4 steps will get your Spring Boot application with Spring REST set up on IBM Bluemix.

· Cloud Zone

Build fast, scale big with MongoDB Atlas, a hosted service for the leading NoSQL database on AWS. Try it now! Brought to you in partnership with MongoDB.

In the previous blog entry I described how to document REST APIs in Spring Boot applications via Swagger. Below I explain how to deploy these applications as Docker containers to IBM Bluemix. As example I use again the Spring REST sample.

In the Dockerfile (in the project root directory) define how to build the Docker image.

FROM java:8
ADD target/gs-rest-service-0.1.0.jar app.jar
RUN bash -c 'touch /app.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

From the root directory invoke the following commands.

mvn package
docker build -t gs-rest-service . 
docker run --name gs-rest-service -p 80:8080 -d -t gs-rest-service

After this you can run the sample in our local Docker environment.


In order to push the image to Bluemix invoke the following commands.

cf login
cf ic login
docker tag gs-rest-service registry.ng.bluemix.net/nheidloff/gs-rest-service
docker push registry.ng.bluemix.net/nheidloff/gs-rest-service

To run the sample on Bluemix create a Docker container group.


After this you can run your REST API on Bluemix.



Now it's easier than ever to get started with MongoDB, the database that allows startups and enterprises alike to rapidly build planet-scale apps. Introducing MongoDB Atlas, the official hosted service for the database on AWS. Try it now! Brought to you in partnership with MongoDB.

spring boot,docker,bluemix

Published at DZone with permission of Niklas Heidloff, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}