Docker Pets is a simple application that's useful for testing out features of Docker Enterprise Edition.
If you are interested in a guide on how to demo Docker Pets on the Universal Control Plane then check out this tutorial.
1.0is the primary version that should be used for demos.latestis also tagged with1.02.0is a version with minor visual changes. Use this to demonstrate rolling updates from1.0to2.0brokenis a version that reports a failed healthcheck. Use this version to demonstrate an unsucessful rolling update.
docker-pets can be run as a stateless single-container application or as a multi-container stateful application. The following are the two images used to deploy docker-pets:
chrch/docker-petsis a front-end Python Flask container that serves up random images of housepets, depending on the given configurationconsulis a back-end KV store that stores the number of visits that thewebservices recieve. It's configured to bootstrap itself with 3 replicas so that we have fault tolerant persistence.
Pets is hosted on the Docker Hub at chrch/docker-pets:latest but you can also build it locally with the following steps
$ git clone https://github.com/dockersamples/docker-pets.git
$ cd docker-pets/web
$ docker build -t docker-pets .
$ docker run -it -p 5000:5000 docker-pets
Docker Swarm can easily be set up to run applications on a single developer laptop. The full app can be brought up to run in the same way it would run in production. We use a compose v3 file to deploy a fully fault tolerant frontend and backend, along with the configurations, secrets, and networks required for the application to run. pets This is the full architecture that is deployed when using pets-dev-compose.yml.
~$ git clone https://github.com/dockersamples/docker-pets.git
~/docker-pets$ docker -v
Docker version 1.13.1-rc1, build 2527cfc
~/docker-pets$ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
fd3ovikiq7tzmdr70zukbsgbs * moby Ready Active Leader
~/docker-pets$ docker stack deploy -c pets-dev-compose.yml pets
The web container has several configuration parameters as environment variables:
DB: Tellswebwhere to finddb. Service name or<ip>:<port>.DEBUG: Putswebcontainers in to debug mode. When mounting a volume for code, they will restart automatically when they detect a change in the code. Defaults to off, set toTrueto turn on.ADMIN_PASSWORD_FILE: Turns secrets on. If set, will password protect the Admin Console ofweb. Set to the full location of the Swarm secret (/run/secrets/< X >)
- Client Web Access - (dev port
5000, prod URLpets.dckr.org)/shows the selected Pet/votedisplays the vote selection/healthdisplays the application health of the given container/killtoggles the health off for one of the web servers
- Admin Console - (dev port
7000, prod URLadmin.pets.dckr.org)/displays voting results, redirects to/loginif secrets are configured/loginrequests login password
- Consul Backend - (dev port
8500, prod ephemeral port)/uidisplays Consul server UI
OPTION_A: Defaults to 'Cats'. Pictures located in/docker-petspets/web/static/option_aOPTION_B: Defaults to 'Dogs'. Pictures located in/docker-pets/web/static/option_bOPTION_C: Defaults to 'Whales'. Pictures located in/docker-pets/web/static/option_c
This full length tutorial will show you how to deploy and demo DDC with the pets app.
Production apps have entirely different requirements when it comes to security, deployment, and also security. Fortunately, deployment on Swarm & UCP is very much the same from development to production. Some minor additions to our compose file add in capabilities for secrets and also for L7 load balancing.
This is the full architecture that is deployed when using pets-prod-compose.yml.
$ echo "mysecret" | docker secret create admin_password_v1 -
$ docker stack deploy -c pets-prod-compose.yml pets

