This book is not finished, it has not gone through technical review nor has it been edited for grammar, punctuation, typos etc. You are reading this book through the advanced release program of OReilly, please consider it a preview of a draft and be kind in your reviews. Feel free to send me any suggestions or comments to how2dock@gmail.com. You can also file a review in the OReilly portal. Happy reading.
Why I Wrote This Book
I have been working on Clouds at the IaaS layer for over ten years. With Amazon AWS, Google GCE and Microsoft Azure now providing large scale Cloud services for several years, it is fair to say that getting access to a server has never been that easy and that quick. The real value to me has been the availability of an API to access these services. We can now program to create an infrastructure and program to deploy an application. These programmable layers help us reach a higher level of automation, which for a business translates in faster time to market, more innovation and better user service.
However, application packaging, configuration, composition of services in a distributed environment has not progressed much despite a lot of work in configuration management and orchestration. Deploying and running a distributed application at scale and in a fault tolerant manner is still hard.
I was not crazy about Docker until I tried it and understood what it brings to the table. Docker primarily brings a new user experience to linux containers. It is not about full virtualization versus containers, it is about the ease of packaging and running an application. Once you start using Docker and enjoy this new experience, the side effect is that you will also start thinking automatically about composition and clustering.
Containers help us think more in terms of functional isolation which in turn forces us to decompose our applications before stitching it back together for a distributed world. Yes, I have drunk the Kool-Aid but hopefully this book will show you why.
How This Book Is Organized
This cookbook is currently made of ten chapters. Each chapter is composed of recipes written in the standard OReilly recipes format (i.e Problem, Solution, Discussion). You can read it front to back or pick up a specific chapter/recipe. Each recipe is made to be independent of the others but when concepts needed in a recipe are needed, appropriate references are provided.
The chapter goes through several Docker installation scenarios including Docker machine. It then presents the basic Docker commands to manage containers, mount data volumes, link containers and so on. At the end of this chapter you should have a working Docker host and you should have started multiple containers as well as understood the lifecycle of containers.
In we introduce the Dockerfile, Docker Hub and show how to build/tag/commit an image. We also show how to run your own Docker registry and setup automated builds. At the end of this chapter you will know how to create Docker images and share them privately or publicly and have some basic foundation to build continuous delivery pipelines.
Currently the chapter only contains stubs of planned recipes. You will find information such as linking containers, using an ambassador container to expose services from different hosts, configuring a custom bridge for use in your Docker host. You will also learn about more advanced networking setups and tools, such as Weave, Flannel and Socketplane VXLAN overlays. Empty chapter right now.
The chapter goes through some configuration of the Docker daemon, especially security settings and access to the Docker API remotely. It also covers a few basic problems, like compiling Docker from source, running its test suite and using a new Docker binary. A few recipes are meant to gain a better insight on linux namespaces and its use in containers.
introduces the new container management platform from Google. Kubernetes provides a way to deploy multi container applications on a distributed cluster. In addition it provides an automated way to expose services and create replicas of containers. We show how to deploy Kubernetes on your own infrastructure, starting with a local Vagrant cluster and subsequently on a set of machines started in the Cloud. We then present the key aspects of Kubernetes: pods, services and replication controllers. Empty chapter right now.
In the . These new distributions provide just enough operating system to run and orchestrate docker containers. Recipes cover installation and access to machines that use these distributions. We also introduce tools that are used with these distributions to ease container orchestration (e.g etcd
, fleet
, systemd
)
One of Dockers strength is its booming ecosystem. In we introduce several tools that have been created over the last 18 months and that leverage Docker to ease application deployment, continuous integration, service discovery and orchestration. As an example, you will find recipes about Fig, Docker Swarm, Flynn and Apache Clocker.
The Docker daemon can be installed on a developer local machine, however, with Cloud computing providing easy access to on-demand servers it is fair to say that a lot of container based applications will be deployed in the Cloud. In . This chapter is currently stubbed out. Empty chapter right now.
The chapters aims to address some concerns about application monitoring when using containers. Monitoring and visibility of the infrastructure and the application has been a huge focus in the DevOps community. As Docker becomes more pervasive as a development and operational mechanism, lessons learned need to be applied to container based applications. This chapter is currently stubbed out. Empty chapter right now.
Finally, in the [Link to Come] chapter we present end to end application deployment scenarios on both single host and clusters. While some basic application deployments are presented in earlier chapters. The recipes presented here aim to be closer to a production deployment setup. This is a more in depth chapter that puts the reader on the path towards designing more complex microservices. This chapter is currently stubbed out. Empty chapter right now.
Warning
The book structure may still change and the order of the chapters may be modified.
Finally, [Link to Come] summarizes the book and provides some tips for further reading and investigation.
Technology You Need to Understand
This book is of an intermediate level and requires a minimum understanding of a few development and system administration concepts. Before diving into the book, you might want to review:
Bash (Unix shell)
This is the default Unix shell on Linux and OS X. Familiarity with the Unix shell, such as editing files, setting file permissions, moving files around the filesystems, user privileges, and some basic shell programming will be very beneficial. If you dont know the Linux shell in general, consult books such as Cameron Newhams Learning the Bash Shell or Carl Albing, JP Vossen, and Cameron Newhams Bash Cookbook, both from OReilly.
Package management
The tools we will present in this book often have multiple dependencies that need to be met by installing some packages. Knowledge of the package management on your machine is therefore required. It could be apt
on Ubuntu/Debian systems, yum
on CentOS/RHEL systems, port
or brew
on OS X. Whatever it is, make sure that you know how to install, upgrade, and remove packages.