This book will get you to the point where you have a running Docker environment and steer you towards good choices for a production environment. Along the way we’ll explore building applications for Docker, testing, deploying, and debugging a running system. We’ll stop by to see a few of the orchestration tools and platforms in the Docker ecosystem. And we’ll round out with guidance on security and best practices for your container environment.
This book is intended for anyone who is looking to solve the complex workflow problems involved in developing and deploying software to production at scale. If you’re interested in Docker, Linux containers, DevOps, and large, scalable, software infrastructures, then this book is for you.
Today there are many conversations, projects, and articles on the Internet about Docker. So why should you devote precious hours to reading this book?
Even though there is a lot of information out there, Docker is a new technology and it is evolving very quickly. Even during the time that it took us to write the first release of this book, Docker, Inc., released four versions of Docker plus a few major tools into their ecosystem. Getting your arms around the scope of what Docker provides, understanding how it fits into your workflow, and getting integration right are not trivial tasks. Few companies or engineering teams have been running it in production for more than a year.
We have worked for over a year and a half building and operating a production Docker platform within the Site Engineering team at New Relic. We implemented Docker in production only months after its release and can share with you some of the experience we gained from evolving our production platform over the last year and a half. The goal is for you to enjoy the wins while avoiding many of the bumps in the road that we experienced. Even though the online documentation for the Docker project is useful, we attempt to give you a bigger picture and expose you to many of the best practices that we have learned along the way.
When you finish this book, you should have enough information to understand what Docker is, why it’s important, how to get it running, how to deploy your applications with it, and be armed with a clear view of what you can do to get to production. It will hopefully be a quick trip through an interesting technology with some very practical applications.
This book is organized as follows:
Chapters 1 and 2 provide an introduction to Docker, and explain what it is and how you can use it.
Chapter 3 takes you through the steps required to install Docker.
Chapters 4 through 6 dive into the Docker client, images, and containers, exploring what they are and how you can work with them.
Chapters 7 and 8 discuss the flow for getting your containers into production and debugging them.
Chapter 9 delves into deploying containers at scale in public and private clouds.
Chapter 10 dives into advanced topics that require some familiarity with Docker and can be important as you start to use Docker in your production environment.
Chapter 11 explores some of the core concepts that have started to solidify in the industry about how to design the next generation of Internet-scale production software.
Chapter 12 wraps everything up and ties it with a bow. It includes a summary of what you have and how it should help you improve the way you deliver and scale software services.
We realize that many people don’t read technical books front to back and that something like the preface is incredibly easy to skip, but if you’re still with us, here is a quick guide to some different approaches to reading this book:
If you are new to Linux containers, start at the beginning. The first two chapters are intended to get your head around the basics of Docker and Linux containers, including what they are, how they work, and why you should care.
If you want to jump right in and install and run Docker on your workstation, then dive right into Chapters 3 and 4, which show you how to install Docker, create and download images, run containers, and much more.
If you are already using Docker for development but need some help getting it into production, consider starting with Chapters 7 through 10, which delve into deploying and debugging containers, and many other advanced topics.
If you are a software or platform architect, you might find Chapter 11 an interesting place to investigate, as we dive into some of the current thinking about designing containerized applications and horizontally scalable services.
The following typographical conventions are used in this book:
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values determined by context.
This element signifies a tip or suggestion.
This element signifies a general note.
This element indicates a warning or caution.
Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business.
Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.
Safari Books Online offers a range of plans and pricing for enterprise, government, education, and individuals.
Members have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more information about Safari Books Online, please visit us online.
Please address comments and questions concerning this book to the publisher:
We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://bit.ly/docker-up-and-running.
To comment or ask technical questions about this book, send email to [email protected].
For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
We’d like to send a heartfelt thanks to the many people who helped make this book possible:
Nic Benders, Bjorn Freeman-Benson, and Dana Lawson at New Relic, who went far above and beyond in supporting this effort, and who ensured that we had time to pursue it.
Laurel Ruma at O’Reilly who initially reached out to us about writing a Docker book, and Mike Loukides who helped get everything on track.
Gillian McGarvey and Melanie Yarbrough, for their efforts copyediting the manuscript, and helping it appear like we were actually paying attention in our high school English classes. 464 commas added and counting…
Wendy Catalano, who helped us ensure that the Index was useful to all of our readers.
A special thanks to our editor, Brian Anderson, who ensured that we knew what we were getting into, and guided us along every step of the way.
All of our peers at New Relic, who have been along for the whole Docker ride and provided us with much of the experience that’s reflected here.
World Cup Coffee, McMenamins Ringlers Pub, and Old Town Pizza in Portland, OR, who kindly let us use their tables and power long after our dishes were empty.
Our draft reviewers, who helped ensure that we were on the right track at various points throughout the writing process: Ksenia Burlachenko, who gave us our very first review as well as a full tech review, Andrew T. Baker, Sébastien Goasguen, and Henri Gomez.
A special callout is due to Alice Goldfuss and Tom Offermann who gave us detailed and consistently useful feedback.
Our families, for being supportive and giving us the required quiet time when we needed it.
And finally to everyone else who encouraged us, gave us advice, or supported us in any way throughout this process.
52.14.80.90