Deploying Spring Boot Applications to Bluemix as Docker Containers

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","","-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
docker push

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


After this you can run your REST API on Bluemix.


  • g00glen00b

    Interesting. Sadly I was unable to link two containers together (MySQL DB container to a Spring boot app container) for some reason.