concept container log in category docker

appears as: container logs, container logs
Learn Docker in a Month of Lunches

This is an excerpt from Manning's book Learn Docker in a Month of Lunches.

Extension fields are custom definitions; in this file there are two called logging and labels . By convention you prefix the block name with an “x”, so the x-labels block defines an extension called labels . The logging extension specifies settings for container logs, and it can be used inside a service definition. The labels extension specifies a key/value pair for a label that can be used inside an existing labels field in a service definition.

A Docker image is the snapshot of a filesystem with all your application binaries and dependencies, and also some metadata telling Docker which process to start when you run a container from the image. That process runs in the foreground, so it’s like starting a shell session and then running a command. As long as the command is active, it has control of the terminal input and output. Commands write log entries to the standard output and standard error streams (called stdout and stderr), so in a terminal session you see the output in your window. In a container, Docker watches stdout and stderr and collects the output from the streams--that’s the source of the container logs.

Figure 19.12 The EFK stack in all its glory--container logs collected and stored for simple searching