SYNOPSIS

my $docker = WWW::Docker->new;

# System information
my $info = $docker->system->info;
say "Docker version: " . $info->{ServerVersion};

# API version
my $version = $docker->system->version;
say "API version: " . $version->{ApiVersion};

# Health check
my $pong = $docker->system->ping;

# Monitor events
my $events = $docker->system->events(
    since => time() - 3600,
);

# Disk usage
my $df = $docker->system->df;

DESCRIPTION

This module provides access to Docker system-level operations including daemon information, version detection, health checks, and event monitoring.

Accessed via $docker->system.

Reference to WWW::Docker client. Weak reference to avoid circular dependencies.

my $info = $system->info;

Get system-wide information about the Docker daemon.

Returns hashref with keys including:

  • ServerVersion - Docker version

  • Containers - Total number of containers

  • Images - Total number of images

  • Driver - Storage driver

  • MemTotal - Total memory

my $version = $system->version;

Get version information about the Docker daemon and API.

Returns hashref with keys including ApiVersion, Version, GitCommit, GoVersion, Os, and Arch.

my $pong = $system->ping;

Health check endpoint. Returns OK string if daemon is responsive.

# Bounded query (since+until) — returns arrayref of event hashrefs:
my $events = $system->events(
    since   => 1234567890,
    until   => 1234567900,
    filters => { type => ['container'] },
);

# Real-time streaming — invokes callback for each event as it arrives:
$system->events(
    filters  => { type => ['container'] },
    callback => sub {
        my ($event) = @_;
        printf "Event: %s %s\n", $event->{Type}, $event->{Action};
    },
);

Get real-time events from the Docker daemon.

When callback is provided, events are read incrementally from the socket and the callback is invoked once per event as JSON objects arrive. This is required for long-lived (unbounded) streams; without a callback the response body is buffered in memory, which is only safe when until bounds the response.

Options:

  • since - Show events created since this timestamp

  • until - Show events created before this timestamp

  • filters - Hashref of filters (e.g., { type => ['container', 'image'] })

  • callback - CodeRef invoked with each decoded event hashref (enables streaming mode)

my $usage = $system->df;

Get data usage information (disk usage by images, containers, and volumes).

Returns hashref with LayersSize, Images, Containers, and Volumes arrays.

8 POD Errors

The following errors were encountered while parsing the POD:

Around line 48:

Unknown directive: =attr

Around line 59:

Unknown directive: =method

Around line 88:

Unknown directive: =method

Around line 105:

Unknown directive: =method

Around line 129:

Unknown directive: =method

Around line 131:

Non-ASCII character seen before =encoding in '—'. Assuming UTF-8

Around line 175:

Unknown directive: =method

Around line 185:

Unknown directive: =seealso