Monitoring Docker

Instana automatically discovers and monitors Docker containers to provide you with realtime insights into metadata (labels), metrics, and any supported technologies running within each discovered container.

Along with monitoring the health of each container and receiving alerts of any issues, you can also enable service discovery to leverage all of your container information.

Support information

To make sure that the Docker sensor is compatible with your current setup, check the following support information sections:

Supported versions and support policy

The sensor supports the following versions of Docker:

  • Docker 23.0
  • Docker 25.0
  • Docker 26.x
  • Docker 27.x

The following table shows the latest supported version and support policy:

Table 1. Latest supported version and support policy
Technology Support policy Latest version Latest supported version
Docker 45 days 27.3 27.3

For more information about the support policy, see Support strategy for sensors.

Installation

For detailed installation instructions, see Installing the agent on Docker.

The Instana agent requires Docker version 1.11 or higher.

Metrics collection

To view the metrics, select Infrastructure in the sidebar of the Instana User interface, click a specific monitored host, and then you can see a host dashboard with all the collected metrics and monitored processes.

By default, Docker metrics are collected every 10 seconds. This interval can be configured within the agent configuration file <agent_install_dir>/etc/instana/configuration.yml:

com.instana.plugin.docker:
  stats:
    interval: 10

To view an overview of CPU and memory usage of your containers, activate the metric overview option on the infrastructure map. You can also use the Dynamic Focus feature to identify and isolate parts of your infrastructure within the context of your containers.

On the Docker container dashboard, the configuration and performance metrics for the container are displayed.

To view detailed information for the running container, click Get Container Info. The information displayed is the same as running the docker inspect command.

Configuration data

Configuration Description
Image The Docker image name.
Command
Created The container created timestamp.
Started The container started timestamp.
Id The container ID.
Names The container name.
Network Mode The configured network settings for the container.
Storage Driver The configured storage driver.
Docker version The Docker version in use.
Container Labels Labels applied to the container.
Ports

Performance metrics

Using the Docker Engine API, the performance metrics are returned from the /containers/{id}/stats endpoint.

CPU Total %

The total % of CPU usage. The current measured KPI value is displayed.

Data point: value is collected from the total_usage key returned in the cpu_stats object.

Memory usage %

The total memory usage in percentage. The current measured KPI value is displayed.

Data point: value is calculated as quotient of usage and limit keys returned in the memory_stats object.

CPU

The total, kernel, and user metrics as well as their normalized values in range [0, 100]% are displayed on a graph over a selected time period.

Data points: the values are collected from the total_usage, usage_in_kernalmode, and usage_in_usermode keys returned in the cpu_stats object.

Throttling count and time values are displayed on a graph over a selected time period.

Data points: the values are collected from the periods and throttling_time keys returned in the cpu_stats object.

Memory

The usage, RSS, cache metrics and memory usage are displayed on a graph over a selected time period.

Data points: the values are collected from the usage, total_rss, and total_cache keys returned in the memory_stats object. The memory usage is derived metric displayed in percentage.

Active anonymous, active cache, inactive anonymous, and inactive cache metrics are displayed on a graph over a selected time period.

Data points: the values are collected from the active_anon, active_file, inactive_anon, and inactive_file keys returned in the memory_stats object.

Block IO

The read and write values are displayed on a graph over a selected time period.

Data point: the values are collected from the blkio.io_service_bytes key returned in the blkio_stats object.

Network

The network rx (received) and tx (transmitted) bytes, errors, packets, and dropped metrics are displayed on a graph over a selected time period.

Data points: all values are collected from keys returned in the network object; rx_dropped, rx_bytes, rx_errors, rx_packets, tx_dropped, tx_bytes, tx_errors, and tx_packets.

For detailed information about specific Docker runtime metrics, see the Docker documentation.

Health signature

For each sensor, there is a curated knowledgebase of health signatures that are evaluated continuously against the incoming metrics and are used to raise issues or incidents depending on user impact.

Built-in events trigger issues or incidents based on failing health signatures on entities, and custom events trigger issues or incidents based on the thresholds of an individual metric of any given entity.

For information about the built-in events for the Docker sensor, see the Built-in events reference.

Configuring the Docker log sensor

By default, log collection is disabled in the Docker sensor. You need to configure the Docker log sensor to enable logging. However, the Docker log sensor has certain limitations. For more information, see Limitations of Docker log sensor.

Enabling Docker log collection

To enable log collection, complete the following steps:

  1. Obtain an add-on to the Instana license. To purchase the add-on license, contact your IBM sales representative.

  2. Enable log collection by configuring the Docker log sensor in the agent configuration file as shown in the following example:

    com.instana.plugin.docker:
        logs:
          enabled: true
    

    The following example shows the possible configuration options with their default values:

    com.instana.plugin.docker:
        logs:
          enabled: true
        unixSocket: "/var/run/docker.sock"
        maxBufferSize: 16777216
        minBatchSize: 1024
        minBatchWithholdCount: 2
        sendInterval: 1
        socketTimeout: 600
        maxLineLength: 16384
    

    The following table lists the configuration options and their description:

    Table 3: Configuration options for Docker log collection
    Configuration option Description Default value
    unixSocket The path to the Docker daemon's socket. "/var/run/docker.sock"
    maxBufferSize The maximum internal buffer size in bytes. This controls how much log message data can be stored in memory inside the sensor while reading. 16777216
    minBatchSize The minimum size of a message batch to be transmitted to the server, in characters. A batch of messages is not transmitted until it reaches at least this size (up to minBatchWithholdCount retries). 1024
    minBatchWithholdCount The number of times a batch can be held back for being too small before it is sent anyway. If a log batch is smaller than minBatchSize, it isn't sent right away. Even if the amount of data remains smaller than minBatchSize, it is eventually sent anyway when the number of tries exceeds this number. 2
    sendInterval The interval to be waited between attempts to send a log batch, in seconds. 1
    socketTimeout Duration, in seconds, for establishing a socket connection before timing out. 600
    maxLineLength The maximum length of a line in the log, in characters. Since this length is measured in characters, the actual number of bytes used varies based on the encoding. 16384

After you enable the log collection, you can view the logs in the Instana UI. For more information, see Viewing Docker logs.

Disabling Docker log collection

To disable Docker logging again, use one of the following options:

  • Set the enabled flag to false in the agent configuration file:

    com.instana.plugin.docker:
        logs:
          enabled: false
    
  • Remove the logs section from the agent configuration file.

Logging is disabled by default.

Avoiding duplicate logs

The agent's AutoTracing functions automatically gather trace logs from applications inside containers, so enabling both trace logs and Docker logs results in duplicate logs. To avoid this issue, enable only one or other.

Application trace logs have the advantage of being correlated with the application traces, while Docker logs are not. But application traces collect only ERROR and WARNING level logs, while the Docker log sensor collects the entire log output stream, including logs at all levels.

Viewing Docker logs

To view Docker logs, complete the following steps:

  1. From the navigation menu in the Instana UI, click Logs.
  2. Click Analyze logs.
  3. In the Filter field on the Analytics logs dashboard, add the Docker container filter.

You can view all the logs that are collected by the Docker log sensor.

Streams

The Docker log sensor collects the streams stdout and stderr from Docker containers.

Limitations of Docker log sensor

The Docker log sensor has the following limitations:

  • Collecting container logs requires the Docker daemon to be running.
  • The Docker log sensor does not collect logs from Docker environments that use Containerd as the container technology. To monitor these containers, use the Containerd sensor.