Book Image

Build Your Own PaaS with Docker

By : Oskar Hane
Book Image

Build Your Own PaaS with Docker

By: Oskar Hane

Overview of this book

<p>Docker is a great tool in many ways for developers and people in DevOps.</p> <p>We begin by learning how easy it is to create and publish your own customized Docker images and making them available to everyone. We also see how practical it is to separate every service to its own container. When you have published separated service containers, the process of running all kinds of platforms in the same server for easier cloud computing is a walk in the park.</p> <p>This book walks you through a use case project that will teach you how to customize and create your own Docker image, allowing you to run any platform you want. The project evolves throughout the book and emerges as a complete three containers Wordpress/MySQL platform when finished.</p> <p>By the end of the book, you will know how to create such a container on a Wordpress/MySQL platform, among others.</p>
Table of Contents (15 chapters)
Build Your Own PaaS with Docker
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Automating the process of mapping domains


The limitations in this setup are that it's manual and hands-on every time a new domain is added. On my website (http://oskarhane.com), I've written some blog posts about how this process could be automated and those posts are my most-read posts of all time.

I was very glad when I found nginx-proxy by Jason Wilder. nginx-proxy solves this problem in a more clever way than me by monitoring Docker events via the Docker Remote API.

Note

You can read more about nginx-proxy on its GitHub page (https://github.com/jwilder/nginx-proxy).

nginx-proxy comes as a container and we can run it by executing the following command:

docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock jwilder/nginx-proxy

We are giving the container our Docker socket, so it can listen for the events we are interested in, which are container starts and stops. We also bind the Docker hosts' port 80 to this new container, making it the entrance container for all incoming web requests...