Demo of pulling app image from the Docker Registry and running it with an nginx proxy.
Even if you don't have the docker-demo image locally, docker-compose will pull it down for you.
docker-compose.yml
- Tells Docker compose to run the cyface/docker-demo image, and run nginx as a proxy in front.nginx.conf
- configuration file for the nginx image - overlays the config file in the image when it runs.
docker-compose up
- starts django and nginx- You can browse to http://localhost
- Try changing the port in
nginx.conf
to50000
- Then stop docker-compose with
ctrl-c
- Start it again with
docker-compose up
- Then stop docker-compose with
- Then browse to http://localhost:50000
- This overlays the file
/etc/nginx/nginx.conf
in the container with the local filenginx.conf
inread only
(ro) mode: volumes:
./nginx.conf:/etc/nginx/nginx.conf:ro
This ensures that django starts before nginx:
depends_on:
django
- The
events
section is required, but does nothing in this case. - The
http
section tells nginx to listen on all IP addresses and host names on port 80. - The proxy passes all traffic back to Django on port 8000 for everything under /.
- The hostname
django
is created automatically bydocker-compose
because that is what the service name indocker-compose.yml
is.