Short Description
A very basic dockerized Flask app that prints the hostname of the docker container it is running in
Full Description
Sample Flask App in a Docker Container
Description
A very basic Flask app in a Docker container. I've used it to demonstrate Mesos + Marathon + Haproxy docker scaling.
Build
- Method 1
- Pull the image from the docker registry (docker hub) and rename it
$> docker pull sbobylev/docker_sample_flask_app $> docker tag sbobylev/docker_sample_flask_app docker_sample_flask_app $> docker rmi sbobylev/docker_sample_flask_app
- Pull the image from the docker registry (docker hub) and rename it
- Method 2
- Build the image from scratch
$> git clone https://github.com/sbobylev/docker_sample_flask_app.git $> cd docker_sample_flask_app $> docker build --rm=true -t docker_sample_flask_app .
- Build the image from scratch
Run
$> docker run -p 8080:8080 -d sbobylev/docker_sample_flask_app
40dd743afd0ca2a09549416ec8b5b9592754f25a93606fd2e1f2c2ed7b406561
$> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
40dd743afd0c sample-flask-app:latest "python app.py" 4 seconds ago Up 3 seconds 0.0.0.0:8080->8080/tcp jolly_wilson
Test
$> curl http://localhost:8080
Your current server is 40dd743afd0c