NAME
WWW::Docker::Container - Docker container entity
VERSION
version 0.100
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.
client
Reference to WWW::Docker client. Used for delegating operations.
Id
Container ID (64-character hex string).
Names
ArrayRef of container names (from list).
Image
Image name used to create the container.
Created
Container creation timestamp (Unix epoch).
State
Container state. From list: string like running, exited. From inspect: hashref with Running, Paused, ExitCode, etc.
Status
Human-readable status string (e.g., "Up 2 hours").
Name
Container name (from inspect, includes leading /).
start
$container->start;
Start the container. Delegates to "start" in WWW::Docker::API::Containers.
stop
$container->stop(timeout => 10);
Stop the container. Delegates to "stop" in WWW::Docker::API::Containers.
restart
$container->restart;
Restart the container.
kill
$container->kill(signal => 'SIGTERM');
Send a signal to the container.
remove
$container->remove(force => 1);
Remove the container.
logs
my $logs = $container->logs(tail => 100);
Get container logs.
inspect
my $updated = $container->inspect;
Get fresh container information.
pause
$container->pause;
Pause all processes in the container.
unpause
$container->unpause;
Unpause the container.
top
my $processes = $container->top;
List running processes in the container.
stats
my $stats = $container->stats;
Get resource usage statistics.
is_running
if ($container->is_running) { ... }
Returns true if container is running, false otherwise. Works with both list and inspect response formats.
SEE ALSO
WWW::Docker::API::Containers - Container API operations
WWW::Docker - Main Docker client
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-docker/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2025 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.