Book Image

Mastering Docker

By : Scott Gallagher
Book Image

Mastering Docker

By: Scott Gallagher

Overview of this book

<p><span id="description" class="sugar_field">Docker has been a game-changer when it comes to virtualization – it has now grown to become a key driver of innovation beyond system administration, having an impact on the world of web development and more. But how can you make sure you’re keeping up with the innovations that it’s driving? How can you be sure you’re using it to its full potential? Mastering Docker shows you how – it not only demonstrates how to use Docker more effectively, it also helps you rethink and reimagine what’s possible with Docker.</span></p> <p><span class="sugar_field"><span id="description" class="sugar_field"> Covering best practices to make sure you’re confident with and the basics, such as building, managing and storing containers, before diving deeper into Docker security, you’ll find everything you need to help you extend and integrate Docker in new and innovative ways. You’ll learn how to take greater control over your containers using some of Docker’s most sophisticated and useful tools, such as Docker compose and Docker swarm, before bringing together everything you already know and have learned to put your containers into production and monitor them for safety and performance.</span></span></p> <p><span class="sugar_field"><span class="sugar_field"><span id="description" class="sugar_field"> Beyond this, you’ll also explore even more advanced strategies, as you learn how to extend and integrate Docker with cloud platforms such as Heroku and OpenStack, and how tools such as Kubernetes can improve the way you manage large-scale container orchestration. With further guidance on how you can use configuration management tools such as Puppet, Chef and PowerShell, by the end of the book you’ll have a broad and detailed sense of exactly what’s possible with Docker – and how seamlessly it fits with a range of other platforms and tools.</span></span></span></p>
Table of Contents (20 chapters)
Mastering Docker
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Preface

So hot off the presses, the latest buzz that has been on the tip of everyone's tongues and the topic of almost any conversation that includes containers these days is Docker! With this book, you will go from just being the person in the office who hears that buzz to the one who is tooting it around every day. Your fellow office workers will be flocking to you for anything related to Docker and shower you with gifts—well, maybe not gifts, but definitely tapping your brain for knowledge!

What this book covers

Chapter 1, Docker Review, will just be a review of Docker. If you are new to Docker, then this chapter will get you going for the future chapters. This chapter will cover the items you would see in the Docker command line as well as the purpose of Dockerfile and the contents that are contained inside it.

Chapter 2, Up and Running, will explain how to go from just reading the documentation and looking at the help contents of files to running some Docker commands. You will also learn how to create or build your own base containers, which will be the basis of all your future containers. Learn how to create and manage Docker volumes and how to pass environmental variables during the build process.

Chapter 3, Container Image Storage, will show the locations to store items such as Docker Hub and the Docker Hub Enterprise. What are the differences between the two. When should you use one over the other. It will help you answer these questions. Also, you'll learn how to set up automated image builds based off the code you have stored in places such as GitHub. What are the pieces you need to get all this set up and working.

Chapter 4, Managing Containers, will show how you can manage all the containers you have created and stored. In this chapter, the focus will be on using the command line. So, if you do decide to use a GUI application at a later time, you will understand what is happening in the background and also have a resource to fall back on if needed.

Chapter 5, Docker Security, covers security that has unfortunately become the main focus of not just systems administrators, but everyone involved in projects these days. What are the benefits of using containers over using traditional virtual machines. What is this new Docker security configuration tool that you can use to help you assist with your setup environments. What should you be looking out for? Dive in and let's take a look at it together!

Chapter 6, Docker Machine, talks about the future replacement of the boot2docker instance. Docker Machine is the future of creating your Docker Host environments. With Docker Machine, you can create the hosts of almost any environment from your local command line. You can create them to locally test in VMware Fusion or VirtualBox, or you can create some of them in cloud environments such as AWS, Azure, DigitalOcean, and many more. Come, learn how you can do this!

Chapter 7, Docker Compose, covers one of the most popular items when it comes to Docker—Docker Compose. So, what can you do with this magical tool? Docker Compose helps eliminate the "well it works just fine on my machine." With Compose, you can have the environments set up with all the resources tied together as you want them and hand them off to both the Dev side of the team as well as the Ops side. If it works for one person, it will work for others and vice versa. If something doesn't work, it will help you troubleshoot by replicating the issue with defined steps. You will learn how to use Compose to set up these environments as well as the file structure of the file that Compose references.

Chapter 8, Docker Swarm, is all about how you can cluster your containers together. With Docker Swarm, you can accomplish this task. You will learn how to install and set up these environments. By default, Docker Swarm uses HTTP for communication. You will learn how to set it up to use TLS for secure communication between all your cluster nodes and Swarm manager.

Chapter 9, Docker in Production, says it's time to deploy Docker in your production environment now that you have all the tools in your arsenal. But how do we go about doing this? Let's take a look at the first step on how to do this as well as monitor everything we have set up and running. You will learn items such as how to ensure containers restart when and if there was an error. Also, you will learn how extend to external platforms such as Heroku.

Chapter 10, Shipyard, will focus on one of the three GUI applications that you can utilize to set up and manage your Docker containers and images. We will do a complete walkthrough, from installation to every piece of the Shipyard UI. You will be able to see the benefits of using such a GUI to help manage your environment.

Chapter 11, Panamax, will focus on one of the three GUI applications that you can utilize to set up and manage your Docker containers and images. We will do a complete walkthrough, from installation to every piece of the Panamax UI. This will leave you with the ability to evaluate which GUI is right for your needs.

Chapter 12, Tutum, will focus on one of the three GUI applications that you can utilize to set up and manage your Docker containers and images. Tutum is the latest acquisition by Docker, so this software will only continue to evolve and become more baked into the Docker ecosystem. We will do a complete walkthrough, from installation to every piece of the Tutum UI.

Chapter 13, Advanced Docker, will explain some advance items such as:

  • Scaling Docker: We'll look at how we can scale our environments.

  • Using discovery services: We'll look at using discovery services to help scale our environments.

  • Debugging/Troubleshooting Docker: We'll look at debugging and troubleshooting Docker issues that crop up.

  • Common issues and solutions: We'll look at the common issues that are faced as well as the solutions to fix them.

  • Various Docker APIs: We'll look at the Docker APIs that are out there and how to tie into them and use them to our advantage.

  • Keeping your containers in check: We'll look at how we can keep our containers in check. If they fall out of check, how we can put them back in place.

  • Contributing to Docker: We'll look at how we can contribute to Docker. If we can't contribute to the code, how we can help otherwise.

  • Advanced Docker networking: We'll look at the future of Docker networking and what is coming next that will only enhance our environment.

What you need for this book

The book will walk you through the installation of any tool that you need. You will need a system with Windows, Mac OS, or Linux installed; preferably the latter of the three, as well as an Internet connection.

Who this book is for

The reader at the start of the book should be an experienced Linux developer with some understanding of the Linux filesystems as well as the concept of Linux Container Virtualization. They must have some experience developing services and applications. They should also have knowledge of the fundamentals of Docker, though we will re-establish these fundamentals in the first chapter or two for clarity.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "For example, in an Ubuntu-based system, if you want to install the Apache package, you would first do an apt-get update followed by an apt-get install -y apache2."

A block of code is set as follows:

master:
image:
scottpgallagher/galeramaster
hostname:
master
ports:
    - "3306:3306"
node1:
image:
scottpgallagher/galeranode
hostname:
    node1
links:
    - master
node2:
image:
scottpgallagher/galeranode
hostname:
    node2
links:
    - master

Any command-line input or output is written as follows:

$ docker pull tutum/ubuntu

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "You can search for prebuilt images on the Docker Hub and click on the CREATE button once you have found the one you want to use or test."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.