The example spring boot application which can easily created as a Docker Image is per this spring guide below.
https://spring.io/guides/gs/spring-boot-docker/
1. First we need to ensure the docker is enabled on Diego as shown below.
pasapicella@pas-macbook:~$ cf feature-flag diego_docker
Retrieving status of diego_docker as admin...
OK
Features State
diego_docker enabled
Note: If it's not enabled you would need ADMIN rights to set it as follows
$ cf enable-feature-flag diego_docker
2. Login to Docker Hub from the command line
pasapicella@pas-macbook:~/pivotal/software/docker$ docker login -u pasapples -p ******
Login Succeeded
3. Push your local Docker image to your public Docker Hub Repository as follows
This assumes you have an IMAGE to push as per below.
pasapicella@pas-macbook:~/pivotal/software/docker$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
pasapples/cf 0.0.1 b25e9b214774 3 days ago 881.4 MB
pasapples/gs-spring-boot-docker latest 5fc76927eca2 3 days ago 195.5 MB
gregturn/gs-spring-boot-docker latest a813439710d3 3 days ago 195.4 MB
ubuntu 14.04 f2d8ce9fa988 2 weeks ago 187.9 MB
frolvlad/alpine-oraclejdk8 slim f8103909759b 2 weeks ago 167.1 MB
springio/gs-spring-boot-docker latest 688d6c4ab4d3 18 months ago 609.9 MB
** Push to Docker Hub **
$ docker push pasapples/gs-spring-boot-docker
The push refers to a repository [docker.io/pasapples/gs-spring-boot-docker]
1a701a998f45: Layer already exists
0d4e0b525d4f: Layer already exists
a27c88827076: Pushed
58f7b9930e4f: Layer already exists
9007f5987db3: Layer already exists
latest: digest: sha256:6b3ccae43e096b1fa4d288900c6d2328e34f11e286996ffa582961bad599aee9 size: 1375
4. Login to Docker Hub and verify it's loaded as shown below
https://hub.docker.com/
At this point we are ready to Deploy to our PCF instance and it's assumed you have already logged into the instance prior to running this next step
5. Push as shown below to PCF
pasapicella@pas-macbook:~$ cf push springboot-docker --docker-image pasapples/gs-spring-boot-docker --random-route -i 1 -m 512M -t 180
Creating app springboot-docker in org apples-org / space development as papicella@pivotal.io...
OK
Creating route springboot-docker-oological-superseniority.apps.pcfdemo.net...
OK
Binding springboot-docker-oological-superseniority.apps.pcfdemo.net to springboot-docker...
OK
Starting app springboot-docker in org apples-org / space development as papicella@pivotal.io...
Creating container
Successfully created container
Staging...
Staging process started ...
Staging process finished
Exit status 0
Staging Complete
Destroying container
Successfully destroyed container
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
1 of 1 instances running
App started
OK
App springboot-docker was started using this command `java -Djava.security.egd=file:/dev/./urandom -jar /app.jar `
Showing health and status for app springboot-docker in org apples-org / space development as papicella@pivotal.io...
OK
requested state: started
instances: 1/1
usage: 512M x 1 instances
urls: springboot-docker-oological-superseniority.apps.pcfdemo.net
last uploaded: Tue Oct 11 02:04:42 UTC 2016
stack: unknown
buildpack: unknown
state since cpu memory disk details
#0 running 2016-10-11 01:07:34 PM 104.3% 309.3M of 512M 1.4M of 1G
pasapicella@pas-macbook:~$ cf create-app-manifest springboot-docker
Creating an app manifest from current settings of app springboot-docker ...
OK
Manifest file created successfully at ./springboot-docker_manifest.yml
pasapicella@pas-macbook:~$ cat springboot-docker_manifest.yml
applications:
- name: springboot-docker
instances: 1
memory: 512M
disk_quota: 1024M
host: springboot-docker-oological-superseniority
domain: apps.pcfdemo.net
stack: cflinuxfs2
timeout: 180
More Information
http://docs.pivotal.io/pivotalcf/1-8/adminguide/docker.html