Skip to content

A basic Python web app to demonstrate linking docker containers

Notifications You must be signed in to change notification settings

dstroppa/hit-counter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hit_counter

A basic Python web app to demonstrate linking docker containers

How to use

Clone this repository for use with:

$ git clone https://github.com/coopermaa/hit_counter

Build a docker image for python web application:

$ docker build -t coopermaa/web .

Run a redis container, the container will export port 6379:

$ docker run --name redis -d redis

Run python web application and link it with redis container:

$ docker run --name web --link redis:redis \
  -p 5000:5000 -d coopermaa/web python app.py

The web app should now be listening on port 5000 on your docker daemon, we can visit it:

# Inside Docker Host
$ curl localhost:5000
Hello World! I have been seen 1 times.
$ curl localhost:5000
Hello World! I have been seen 2 times.

# Outside Docker host
$ curl <docker host>:5000
Hello World! I have been seen 3 times.

About

A basic Python web app to demonstrate linking docker containers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 84.1%
  • JavaScript 8.7%
  • HTML 6.5%
  • Python 0.7%