Skip to content
Implementation of the Docker "getting started" tutorial
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
Dockerfile
README.md
docker-compose.yml
env.rc
setup.sh
teardown.sh

README.md

Docker Getting Started

This repository is a simple implementation of a Flask-based application following the tutorials in https://docs.docker.com/get-started/. You may also like to read this for a nice introduction to Dockerizing a Flask application: https://medium.com/@angellom/build-a-docker-image-out-of-a-flask-project-6b22122ff0f0.

Please note that these materials were created and tested using MacOS Sierra. Your mileage may vary considerably on Windows.

Prerequisites

Building

Assuming the pre-prerequisites are met, then running the application is simple. First update env.rc to change relevant values. The only thing you will definitely need to configure is USER, as this is used as part of the Docker Hub repository tag. This example builds an image and pushes it to Docker Hub so that the deployed swarm can pull it down (at a later point I hope to investigate whether the Docker Machine can pull from the local docker repository).

Second thing is to ensure you are logged into docker hub, substituting the appropriate username which we assume to be the same as the USER setting.

docker login -u username

Next execute the setup script to build the image, construct some docker machines, setup the swarm, and deploy the application:

./setup.sh

At the end of the execution, the script will report URLs at which you can reach the Visualizer application, and our deployed Flask application. Note that it may take 30 seconds or more for the application stack to stabilise, and Redis to be available. Repeatedly visiting the application should see the count of visits counting up, and the hostname of the actual application instance that is responding changing.

e.g.:

Service at    : http://192.168.99.117:4000
Visualizer at : http://192.168.99.117:8080

Cleaning up

Cleaning up when finished is straightforward:

./teardown.sh

This should halt the application and Docker Stack, and the docker machines created for the demonstration.

You can’t perform that action at this time.