O'Reilly logo

Docker Networking and Service Discovery by Michael Hausenblas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Preface

When you start building your applications with Docker, you’re excited about the capabilities and opportunities you encounter: it runs the same in dev and in prod, it’s straightforward to put together a Docker image, and the distribution is taken care of by tools like the Docker hub. So, you’re satisfied with how quickly you were able to port an existing, say, Python app, to Docker and you want to connect it to another container that has a database, such as PostgreSQL. Also, you don’t want to manually launch the Docker containers and implement your own system that takes care of checking if the containers are still running, and if not, relaunch them.

At this juncture, you realize there are two related challenges you’ve been running into: networking and service discovery. Unfortunately, these two areas are emerging topics, which is a fancy way of saying there are still a lot of moving parts, and there are currently few best practice resources available in a central place. Fortunately, there are tons of recipes available, even if they are scattered over a gazillion blog posts and many articles.

The Book

So, I thought to myself: what if someone wrote a book providing some basic guidance for these topics, pointing readers in the right direction for each of the technologies?

That someone turned out to be me, and with this book I want to provide you—in the context of Docker containers—with an overview of the challenges and available solutions for networking as well as service discovery. I will try to drive home three points throughout this book:

  • Service discovery and container orchestration are two sides of the same coin.

  • Without a proper understanding of the networking aspect of Docker and a sound strategy in place, you will have more than one bad day.

  • The space of networking and service discovery is young: you will find yourself starting out with one set of technologies and likely change gears and try something else; do not worry, you’re in good company and in my opinion it will take another two odd years until standards emerge and the market is consolidated.

You

My hope is that the book is useful for:

  • Developers who drank the Docker Kool-Aid

  • Network ops who want to brace themselves for the upcoming onslaught of their enthusiastic developers

  • (Enterprise) software architects who are in the process of migrating existing workloads to Docker or starting a new project with Docker

  • Last but not least, I suppose that distributed application developers, SREs, and backend engineers can also extract some value out of it.

Note that this is not a hands-on book—besides the basic Docker networking stuff in Chapter 2—but more like a guide. You will want to use it to make an informed decision when planning Docker-based deployments. Another way to view the book is as a heavily annotated bookmark collection.

Me

I work for a cool startup called Mesosphere, Inc. (the commercial entity behind Apache Mesos), where I help devops to get the most out of the software. While I’m certainly biased concerning Mesos being the best current option to do cluster scheduling at scale, I will do my best to make sure throughout the book that this preference does not negatively influence the technologies discussed in each section.

Acknowledgments

Kudos to my Mesosphere colleagues from the Kubernetes team: James DeFelice and Stefan Schimanski have been very patient answering my questions around Kubernetes networking. Another round of kudos go out to my Mesosphere colleagues (and former Docker folks) Sebastien Pahl and Tim Fall—I appreciate all of your advice around Docker networking very much! And thank you as well to Mohit Soni, yet another Mesosphere colleague who took time out of his busy schedule to provide feedback!

I further would like to thank Medallia’s Thorvald Natvig, whose Velocity NYC 2015 talk triggered me to think deeper about certain networking aspects; he was also kind enough to allow me to follow up with him and discuss motivations of and lessons learned from Medallia’s Docker/Mesos/Aurora prod setup.

Thank you very much, Adrian Mouat (Container Solutions) and Diogo Mónica (Docker, Inc.), for answering questions via Twitter, and especially for the speedy replies during hours where normal people sleep, geez!

I’m grateful for the feedback I received from Chris Swan, who provided clear and actionable comments throughout, and by addressing his concerns, I believe the book became more objective as well.

Throughout the book writing process, Mandy Waite (Google) provided incredibly useful feedback, particularly concerning Kubernetes; I’m so thankful for this and it certainly helped to make things clearer. I’m also grateful for the support I got from Tim Hockin (Google), who helped me clarify the confusion around the new Docker networking features and Kubernetes.

Thanks to Matthias Bauer, who read an early draft of this manuscript and provided great comments I was able to build on.

A big thank you to my O’Reilly editor Brian Anderson. From the first moment we discussed the idea to the drafts and reviews, you’ve been very supportive, extremely efficient (and fun!), and it’s been a great pleasure to work with you.

Last but certainly not least, my deepest gratitude to my awesome family: our “sunshine” Saphira, our “sporty girl” Ranya, our son and “Minecraft master” Iannis, and my ever-supportive wife Anneliese. Couldn’t have done this without you and the cottage is my second-favorite place when I’m at home. ;)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required