If you are trying to deploy a Java Tomcat app on a Docker system, you might find other tutorials which will take you hours of heartache to get just right. How about deploying a full custom Tomcat app in just 30 seconds?
See For Yourself
Don't believe me? Just try these 10 simple steps:
$ brew install maven boot2docker # on OS X $ boot2docker init ; boot2docker up # on OS X $ sudo gem install bundler highline building $ git clone https://github.com/jesperfj/webapp-with-jndi $ cd webapp-with-jndi $ mvn package $ cd target/my-webapp $ building -b http://github.com/jesperfj/buildpack-tomcat.git myapp create Dockerfile building docker build -t hhvm-app:latest . hint: To run your app, try: docker run -d -p 8080 -e "PORT=8080" myapp hint To re-build your app, try: docker build -t myapp . $ JAVA_APP_ID=$(docker run -d -p 8080 -e "PORT=8080" myapp) $ curl `docker port $JAVA_APP_ID 8080`/hello Hello World
The basic Heroku Java buildpack doesn't work with every Java app. If you run it from the
jesperfj/webapp-with-jndi base directory it will fail. But if you use the
jesperfj/buildpack-tomcat custom buildpack within the app's directory, everything works smoothly.
This is just a simple example of how much better the developer tooling around Docker has become over the last year. With Docker 1.0 just around the corner, there has never been a better time to start incorporating it into your daily workflow. If you are ready to get your feet wet with CoreOS, try our Building Your First App on CoreOS tutorial.