Docker
Plugin: go.d.plugin Module: docker
Overview
Monitor Docker Engine containers and images: container states and health, each container's status, and image usage and size.
- Totals: containers running, paused and exited, and containers per health check status.
- Per container: the state and health check status of each container, by name and image, with an optional chart of its writable layer size.
- Images: active and dangling images and the disk space all images take.
It connects to the Docker Engine API over a Unix socket or TCP and only reads; it never creates, starts, stops or removes anything. It makes these requests:
- Ping (
HEAD /_ping, thenGET /_pingwhen needed), before the first request, to agree on the API version. - System info (
GET /info), on every collection. - List images (
GET /images/json), at most once every 5 minutes. - List containers (
GET /containers/json), on every collection, once per container health status (four requests).
This collector is supported on all platforms.
This collector supports collecting metrics from multiple instances of this integration.
The netdata user needs access to the Docker socket (/var/run/docker.sock), which membership in the docker group grants. The collector only sends read requests, but the socket gives full control of the daemon. To restrict it, point address at a socket proxy that allows the ping, system info, image list and container list requests and nothing else.
Default Behavior
Auto-Detection
The stock job connects to unix:///var/run/docker.sock. When the Agent's environment sets DOCKER_HOST, as the Netdata container image does, the job connects there instead.
Limits
- Image charts follow the image list, which is refreshed every 5 minutes (or on every collection when
update_everyis longer), so pulled and removed images can take that long to show. Whether an image is used by a container is updated on every collection. - When a container is removed, its charts stop receiving values and are removed after 5 collections (50 seconds at the default
update_every). - The collector does not use TLS. A daemon that accepts TCP connections only with TLS (usually on port 2376) cannot be monitored over TCP; use its Unix socket or a socket proxy instead.
Performance Impact
The collector itself uses little CPU; the cost falls on the Docker daemon, which does the work for each API request. On Docker Engine 29 and later with the containerd image store, listing images and containers costs dockerd and containerd CPU time that grows with the number of images and containers (moby/moby#53077).
The defaults keep this low: data is collected every 10 seconds, and the image list is requested at most once every 5 minutes. Lowering update_every increases daemon CPU usage. Enabling collect_container_size may result in high CPU usage, depending on the Docker Engine version.
Setup
You can configure the docker collector in two ways:
| Method | Best for | How to |
|---|---|---|
| UI | Fast setup without editing files | Go to Nodes → Configure this node → Collectors → Jobs, search for docker, then click + to add a job. |
| File | If you prefer configuring via file, or need to automate deployments (e.g., with Ansible) | Edit go.d/docker.conf and add a job. |
UI configuration requires paid Netdata Cloud plan.
Prerequisites
Give the netdata user access to the Docker socket
Applies when the Agent runs on the Docker host. The Netdata installers and native packages add the netdata user to the docker group when that group exists at install time. If Docker was installed after Netdata, add the user and restart the Agent:
sudo usermod -aG docker netdata
sudo systemctl restart netdata
sudo -u netdata docker info succeeds once the access is in place. The Netdata container image needs no action: it joins the group of the mounted socket at startup.
Configuration
Options
The following options can be defined globally: update_every, autodetection_retry.
Config options
| Group | Option | Description | Default | Required |
|---|---|---|---|---|
| Target | address | Docker daemon address: a Unix socket (unix:// and a path) or a TCP endpoint (tcp:// and a host and port). | unix:///var/run/docker.sock | yes |
| timeout | Docker API request timeout, in seconds. | 2 | no | |
| Containers | container_selector | Names of the containers that get their own charts, as a simple pattern. Leave empty to chart every container; the totals always count every container. | * | no |
| collect_container_size | Adds a chart of each container's writable layer size. Docker computes the sizes on every collection, which can cost the daemon significant CPU and disk I/O. | no | no | |
| Collection | update_every | Data collection interval, in seconds. | 10 | no |
| autodetection_retry | How often to retry the initial connection when the job fails to start, in seconds. Zero disables retries. | 0 | no | |
| Virtual Node | vnode | Associates this job with a Virtual Node. | no |
container_selector
A container labeled netdata.cloud/ignore=true (or yes) gets no charts of its own, whatever the selector matches; the totals and image usage still count it.
via UI
Configure the docker collector from the Netdata web interface:
- Go to Nodes.
- Select the node where you want the docker data-collection job to run and click the ⚙ (Configure this node). That node will run the data collection.
- The Collectors → Jobs view opens by default.
- In the Search box, type docker (or scroll the list) to locate the docker collector.
- Click the + next to the docker collector to add a new job.
- Fill in the job fields, then click Test to verify the configuration and Submit to save.
- Test validates the provided settings and checks the collector's startup prerequisites. Successful validation does not guarantee that every metric will be available during collection.
- If it fails, an error message appears with details (for example, connection refused, timeout, or command execution errors), so you can adjust and retest.
via File
The configuration file name for this integration is go.d/docker.conf.
The file format is YAML. Generally, the structure is:
update_every: 1
autodetection_retry: 0
jobs:
- name: some_name1
- name: some_name2
You can edit the configuration file using the edit-config script from the
Netdata config directory.
cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
sudo ./edit-config go.d/docker.conf
Examples
Basic
A local Docker Engine on the default socket.
jobs:
- name: local
address: 'unix:///var/run/docker.sock'
Monitor selected containers
Gives every container except those whose names start with test- its own charts. The totals still count all containers.
Config
jobs:
- name: local
address: 'unix:///var/run/docker.sock'
container_selector: '!test-* *'
Multi-instance
Note: When you define multiple jobs, their names must be unique.
Collecting metrics from a local daemon and a remote daemon listening on TCP.
Config
jobs:
- name: local
address: 'unix:///var/run/docker.sock'
- name: remote
address: 'tcp://203.0.113.10:2375'
Alerts
The following alerts are available:
| Alert name | On metric | Description |
|---|---|---|
| docker_container_unhealthy | docker.container_health_status | ${label:container_name} docker container health status is unhealthy |
| docker_container_down | docker.container_state | Docker container ${label:container_name} is currently not running |
Metrics
Metrics grouped by scope.
The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.
Per Docker instance
Totals for the Docker Engine the job connects to.
This scope has no labels.
Metrics:
| Metric | Description | Dimensions | Unit |
|---|---|---|---|
| docker.containers_state | Total number of Docker containers in various states | running, paused, exited | containers |
| docker.containers_health_status | Total number of Docker containers in various health states | healthy, unhealthy, not_running_unhealthy, starting, no_healthcheck | containers |
| docker.images | Total number of Docker images in various states | active, dangling | images |
| docker.images_size | Total size of all Docker images | size | bytes |
Per container
One container, by name, for containers the container_selector matches and that do not carry the netdata.cloud/ignore label. The writable layer size chart needs collect_container_size.
Labels:
| Label | Description |
|---|---|
| container_name | Container name, for example nginx-proxy. |
| image | Image the container was created from, for example nginx:1.27. |
Metrics:
| Metric | Description | Dimensions | Unit |
|---|---|---|---|
| docker.container_state | Docker container state | running, paused, exited, created, restarting, removing, dead | state |
| docker.container_health_status | Docker container health status | healthy, unhealthy, not_running_unhealthy, starting, no_healthcheck | status |
| docker.container_writeable_layer_size | Docker container writable layer size | writable_layer | bytes |
Live Data
This collector exposes real-time functions for interactive troubleshooting in the Live tab.
Containers
Retrieves container list data equivalent to docker ps -a.
This function calls the Docker Container List API with all=true and returns both running and non-running containers in a table similar to Docker CLI output.
Use cases:
- Quickly inspect all containers (running, exited, paused, dead) from Netdata
- Correlate container lifecycle with metric changes and alerts
- Verify exposed ports, image tags, and container names without shell access
| Aspect | Description |
|---|---|
| Name | Docker:container-ls |
| Require Cloud | yes |
| Performance | Executes a single Docker API request (ContainerList with all=true):• No per-container inspect requests are issued • Response size grows with total container count • Large histories with many stopped containers may return more rows |
| Security | Exposes container metadata that may include sensitive details: • Container command text may include runtime arguments • Image names, ports, and container names are visible • Restrict access to authorized operators |
| Availability | Available when: • Docker collector is initialized and connected • Docker API list-containers request succeeds • Returns HTTP 503 while collector is initializing • Returns HTTP 500 on Docker API errors • Returns HTTP 504 on timeout |
Prerequisites
No additional configuration is required.
Parameters
This function has no parameters.
Returns
Container inventory from Docker Engine. Each row represents one container returned by docker ps -a.
| Column | Type | Unit | Visibility | Description |
|---|---|---|---|---|
| CONTAINER ID | string | Short container ID (12 characters). | ||
| IMAGE | string | Container image reference. | ||
| COMMAND | string | Container command as reported by Docker API. | ||
| CREATED | string | Human-readable container creation age (for example, '5 days ago'). | ||
| STATUS | string | Docker status string (for example, 'Up 3 weeks' or 'Exited (0) 4 weeks ago'). | ||
| State (Raw) | string | hidden | Raw Docker state value (for example, running, exited, paused, restarting, dead). | |
| PORTS | string | Published or exposed ports summary. | ||
| NAMES | string | Container name. | ||
| Container ID (Full) | string | hidden | Full 64-character container ID. | |
| Created (Unix) | integer | seconds | hidden | Container creation timestamp in Unix seconds. |
Troubleshooting
Diagnostics
Debug Mode
Important: Debug mode is not supported for data collection jobs created via the UI using the Dyncfg feature.
To troubleshoot issues with the docker collector, run the go.d.plugin with the debug option enabled. The output
should give you clues as to why the collector isn't working.
-
Navigate to the
plugins.ddirectory, usually at/usr/libexec/netdata/plugins.d/. If that's not the case on your system, opennetdata.confand look for thepluginssetting under[directories].cd /usr/libexec/netdata/plugins.d/ -
Switch to the
netdatauser.sudo -u netdata -s -
Run the
go.d.pluginto debug the collector:./go.d.plugin -d -m dockerTo debug a specific job:
./go.d.plugin -d -m docker -j jobName
Getting Logs
If you're encountering problems with the docker collector, follow these steps to retrieve logs and identify potential issues:
- Run the command specific to your system (systemd, non-systemd, or Docker container).
- Examine the output for any warnings or error messages that might indicate issues. These messages should provide clues about the root cause of the problem.
System with systemd
Use the following command to view logs generated since the last Netdata service restart:
journalctl _SYSTEMD_INVOCATION_ID="$(systemctl show --value --property=InvocationID netdata)" --namespace=netdata --grep docker
System without systemd
Locate the collector log file, typically at /var/log/netdata/collector.log, and use grep to filter for collector's name:
grep docker /var/log/netdata/collector.log
Note: This method shows logs from all restarts. Focus on the latest entries for troubleshooting current issues.
Docker Container
If your Netdata runs in a Docker container named "netdata" (replace if different), use this command:
docker logs netdata 2>&1 | grep docker
Known Errors
getting system info: permission denied while trying to connect to the docker API at address
Cause
The netdata user cannot open the Docker socket. It is not in the docker group, or it was added after the Agent started.
Fix
Add the netdata user to the docker group and restart the Agent, as described in Prerequisites.
getting system info: failed to connect to the docker API at address; check if the path is correct and if the daemon is running: dial unix path: connect: no such file or directory
Cause
No socket exists at address. Docker is not installed or not running, it uses another socket (rootless Docker listens on unix:///run/user/1000/docker.sock for user ID 1000), or a containerized Agent does not have the host socket mounted.
Fix
Start Docker, or set address to the socket the daemon listens on. For a containerized Agent, mount the socket with -v /var/run/docker.sock:/var/run/docker.sock:ro.
getting system info: Cannot connect to the Docker daemon at address. Is the docker daemon running?
Cause
Nothing accepts connections at address. The socket file exists but the daemon is stopped, or a TCP endpoint refuses or does not answer the connection.
Fix
Start Docker. For a TCP address, check that the daemon or socket proxy listens on that host and port and that a firewall does not block it.
operation: Get "url": context deadline exceeded
Cause
The Docker daemon did not answer within timeout (2 seconds by default). Listing containers and images takes longest, on hosts with many of them and with collect_container_size enabled.
Fix
Raise timeout, for example to 5. If collect_container_size is enabled and the sizes are not needed, disable it.
getting system info: Error response from daemon: Client sent an HTTP request to an HTTPS server.
Cause
address is a TCP endpoint that requires TLS, and the collector does not use TLS.
Fix
Monitor the daemon through its Unix socket, with the Agent on the Docker host, or through a socket proxy that accepts plain connections.
operation: Error response from daemon: <html><body><h1>403 Forbidden</h1> Request forbidden by administrative rules. </body></html>
When
The Agent reaches Docker through an HAProxy-based socket proxy, such as tecnativa/docker-socket-proxy.
Cause
The proxy refuses one of the requests the collector makes. The socket proxy example in the Netdata Docker guide allows only container requests, which is enough for container name resolution but not for this collector.
Fix
Allow the system info, image list and container list requests. With tecnativa/docker-socket-proxy, set these environment variables on the proxy (it allows ping by default):
CONTAINERS=1
IMAGES=1
INFO=1
operation: Error response from daemon: client version version is too new. Maximum supported API version is version
When
The Agent reaches Docker through a socket proxy.
Cause
The proxy refuses the ping request, so the collector cannot agree on an API version with the daemon and uses its newest one, which the daemon does not support.
Fix
Allow HEAD and GET requests to /_ping on the proxy. tecnativa/docker-socket-proxy allows them by default (PING=1).
Do you have any feedback for this page? If so, you can open a new issue on our netdata/learn repository.