Book Image

Extending Docker

By : Russ McKendrick
Book Image

Extending Docker

By: Russ McKendrick

Overview of this book

With Docker, it is possible to get a lot of apps running on the same old servers, making it very easy to package and ship programs. The ability to extend Docker using plugins and load third-party plugins is incredible, and organizations can massively benefit from it. In this book, you will read about what first and third party tools are available to extend the functionality of your existing Docker installation and how to approach your next Docker infrastructure deployment. We will show you how to work with Docker plugins, install it, and cover its lifecycle. We also cover network and volume plugins, and you will find out how to build your own plugin. You’ll discover how to integrate it with Puppet, Ansible, Jenkins, Flocker, Rancher, Packer, and more with third-party plugins. Then, you’ll see how to use Schedulers such as Kubernetes and Amazon ECS. Finally, we’ll delve into security, troubleshooting, and best practices when extending Docker. By the end of this book, you will learn how to extend Docker and customize it based on your business requirements with the help of various tools and plugins.
Table of Contents (15 chapters)

Understanding a plugin


So far, we have established that all the plugins that we have installed have actually nothing to do with Docker directly, so what does a plugin do?

Docker describes a plugin as:

"Docker plugins are out-of-process extensions which add capabilities to the Docker Engine."

This is exactly what we have seen when installing third-party tools, they all run alongside Docker as separate daemons.

Let's assume that we are going to be creating a volume plugin called mobyfs for the remainder of this chapter. The mobyfs plugin is a fictional service which is written in Go and it runs as a daemon.

Discovery

Typically, a plugin will be installed on the same host as the Docker binary. We can register our mobyfs plugin with Docker by creating the following files in either /run/docker/plugins if it's a Unix socket file, or /etc/docker/plugins or /usr/lib/docker/plugins if it is one of the other two files:

  • mobyfs.sock

  • mobyfs.spec

  • mobyfs.json

Plugins that use a Unix socket file must run on...