Chapter 11. Plain sailing—Docker in production and operational considerations

 

This chapter covers

  • Options for logging container output
  • How to monitor your running containers
  • Managing your containers’ resource usage
  • Using Docker’s capabilities to help manage traditional sysadmin tasks

In this chapter we’re going to cover some of the subjects that come up when running in production. Running Docker in production is a big subject, and production use of Docker is still an evolving area. Many major tools are in the early stages of development and were changing as we wrote this book. For example, while we were writing this chapter, Kubernetes went to version 1.0 and a revamped Registry was released by Docker.

In this chapter we focus on showing you some of the key things you should consider when going from volatile environments to stable ones.

11.1. Monitoring

When you run Docker in production, one of the first things you’ll want to consider is how to track and measure what your containers are up to. In this section you’re going to learn how you can get an operational view of both your live containers’ logging activity and their performance.

This is still a developing aspect of the Docker ecosystem, but some tools and techniques are emerging as more mainstream than others. We’ll look at redirecting application logs to the host’s syslog, at redirecting the output of the docker logs command to a single place, and at Google’s container-oriented performance monitoring tool, cAdvisor.

Technique 89 Logging your containers to the host’s syslog

Technique 90 Sending Docker logs to your host’s output system

Technique 91 Monitoring containers with cAdvisor

11.2. Resource control

Technique 92 Restricting the cores a container can execute on

Technique 93 Giving important containers more CPU

Technique 94 Limiting the memory usage of a container

11.3. Sysadmin use cases for Docker

Technique 95 Using Docker to run cron jobs

Technique 96 The “save game” approach to backups

11.4. Summary