Skip to content

noroute/spring-boot-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot 1.0 Hello World in Docker

This is a quick tech demo to integrate the buzzwords of the day: Spring Boot, Docker and Microservices.

Compatibility

  • This has been tested on various Macs and should work on all Unixes supported by Gradle/Docker
  • The Dockerfile currently installs a Java7 VM so you can't compile for Java8
  • There's no support for Windows since I don't have easy access to machines. Therefore, there's no gradlew.bat file to not raise false hopes.

Requirements

  1. Docker

Features

  1. almost self contained (just add docker)
  2. up in 5 secs
  3. no provisioning framework (puppet, chef, etc.)
  4. rebuilt in 10 secs

HowTo

# 1. Build the Spring Boot app
./gradlew build

# 2. builds the docker image
docker build -t 'spring-boot' .

# 3. run the docker image, exposing the port 8080 to our host
DOCKER_ID=$(docker run -p 8080:8080 -d spring-boot)

# 4. Try it!
curl http://127.0.0.1:8080

# 5. Kill it!
docker kill $DOCKER_ID

NOTE

If you're using boot2docker (e.g. you're a Mac user and running docker itself in a VM), your port redirects end up in the VM and will not be visible on your host. This script helps. The original issue is here.

About

Spring Boot, Docker. Buzz.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published