SYNOPSIS
my $docker = WWW::Docker->new;
# Get container from list or inspect
my $containers = $docker->containers->list;
my $container = $containers->[0];
# Access container properties
say $container->Id;
say $container->Status;
say $container->Image;
# Perform operations
$container->start;
$container->stop(timeout => 10);
my $logs = $container->logs(tail => 100);
$container->remove(force => 1);
# Check state
if ($container->is_running) {
say "Container is running";
}
DESCRIPTION
This class represents a Docker container and provides convenient access to container properties and operations. Instances are returned by WWW::Docker::API::Containers methods like list and inspect.
Each attribute corresponds to fields in the Docker API container representation. Methods delegate to WWW::Docker::API::Containers for operations.
Reference to WWW::Docker client. Used for delegating operations.
Container ID (64-character hex string).
ArrayRef of container names (from list).
Image name used to create the container.
Container creation timestamp (Unix epoch).
Container state. From list: string like running, exited. From inspect: hashref with Running, Paused, ExitCode, etc.
Human-readable status string (e.g., "Up 2 hours").
Container name (from inspect, includes leading /).
$container->start;
Start the container. Delegates to "start" in WWW::Docker::API::Containers.
$container->stop(timeout => 10);
Stop the container. Delegates to "stop" in WWW::Docker::API::Containers.
$container->restart;
Restart the container.
$container->kill(signal => 'SIGTERM');
Send a signal to the container.
$container->remove(force => 1);
Remove the container.
my $logs = $container->logs(tail => 100);
Get container logs.
my $updated = $container->inspect;
Get fresh container information.
$container->pause;
Pause all processes in the container.
$container->unpause;
Unpause the container.
my $processes = $container->top;
List running processes in the container.
my $stats = $container->stats;
Get resource usage statistics.
if ($container->is_running) { ... }
Returns true if container is running, false otherwise. Works with both list and inspect response formats.
WWW::Docker::API::Containers - Container API operations
WWW::Docker - Main Docker client
21 POD Errors
The following errors were encountered while parsing the POD:
- Around line 49:
Unknown directive: =attr
- Around line 57:
Unknown directive: =attr
- Around line 65:
Unknown directive: =attr
- Around line 73:
Unknown directive: =attr
- Around line 83:
Unknown directive: =attr
- Around line 91:
Unknown directive: =attr
- Around line 100:
Unknown directive: =attr
- Around line 117:
Unknown directive: =attr
- Around line 135:
Unknown directive: =method
- Around line 148:
Unknown directive: =method
- Around line 161:
Unknown directive: =method
- Around line 174:
Unknown directive: =method
- Around line 187:
Unknown directive: =method
- Around line 200:
Unknown directive: =method
- Around line 213:
Unknown directive: =method
- Around line 226:
Unknown directive: =method
- Around line 239:
Unknown directive: =method
- Around line 252:
Unknown directive: =method
- Around line 265:
Unknown directive: =method
- Around line 283:
Unknown directive: =method
- Around line 292:
Unknown directive: =seealso