NAME
WWW::Docker - Perl client for the Docker Engine API
VERSION
version 0.001
SYNOPSIS
use WWW::Docker;
# Connect to local Docker daemon via Unix socket
my $docker = WWW::Docker->new;
# Or connect to remote Docker daemon
my $docker = WWW::Docker->new(
host => 'tcp://192.168.1.100:2375',
);
# System information
my $info = $docker->system->info;
my $version = $docker->system->version;
# Container management
my $containers = $docker->containers->list(all => 1);
my $result = $docker->containers->create(
Image => 'nginx:latest',
name => 'my-nginx',
);
$docker->containers->start($result->{Id});
# Image operations
$docker->images->pull(fromImage => 'nginx', tag => 'latest');
my $images = $docker->images->list;
# Network and volume management
my $networks = $docker->networks->list;
my $volumes = $docker->volumes->list;
DESCRIPTION
WWW::Docker is a Perl client for the Docker Engine API. It provides a clean object-oriented interface to manage Docker containers, images, networks, and volumes.
Key features:
Pure Perl implementation with minimal dependencies
Unix socket and TCP transport support
Automatic API version negotiation
Object-oriented entity classes (Container, Image, Network, Volume)
Comprehensive logging via Log::Any
Architecture
The distribution is organized into several layers:
Main Client - WWW::Docker - Entry point with API version negotiation
API Modules - Resource-specific API methods:
WWW::Docker::API::System - System info, version, ping
WWW::Docker::API::Containers - Container management
WWW::Docker::API::Images - Image management
WWW::Docker::API::Networks - Network management
WWW::Docker::API::Volumes - Volume management
WWW::Docker::API::Exec - Exec into containers
Entity Classes - Object wrappers for Docker resources:
WWW::Docker::Container - Container entity with convenience methods
WWW::Docker::Image - Image entity
WWW::Docker::Network - Network entity
WWW::Docker::Volume - Volume entity
HTTP Role - WWW::Docker::Role::HTTP - HTTP transport layer
host
Docker daemon connection URL. Defaults to $ENV{DOCKER_HOST} or unix:///var/run/docker.sock.
Supported formats:
unix:///path/to/socket- Unix socket (default)tcp://host:port- TCP connection
api_version
Docker API version to use (e.g., 1.41). If not set, the client will automatically negotiate the highest API version supported by the daemon.
This attribute is set automatically by "negotiate_version".
tls
Enable TLS for secure connections. Defaults to 0. Currently experimental.
cert_path
Path to TLS certificates. Defaults to $ENV{DOCKER_CERT_PATH}.
system
Returns WWW::Docker::API::System instance for system operations like info, version, ping, and events.
containers
Returns WWW::Docker::API::Containers instance for container operations like list, create, start, stop, and remove.
images
Returns WWW::Docker::API::Images instance for image operations like list, pull, push, and remove.
networks
Returns WWW::Docker::API::Networks instance for network operations like list, create, connect, and disconnect.
volumes
Returns WWW::Docker::API::Volumes instance for volume operations like list, create, and remove.
exec
Returns WWW::Docker::API::Exec instance for executing commands in containers.
negotiate_version
$docker->negotiate_version;
Automatically negotiate the highest API version supported by the Docker daemon. This is called automatically before the first API request if "api_version" is not set.
After negotiation, "api_version" will contain the negotiated version (e.g., 1.41).
ENVIRONMENT VARIABLES
DOCKER_HOST-
Docker daemon connection URL. Used as default for "host" if not explicitly set.
Examples:
unix:///var/run/docker.sock,tcp://localhost:2375 DOCKER_CERT_PATH-
Path to TLS certificates directory. Used as default for "cert_path".
SEE ALSO
WWW::Docker::Role::HTTP - HTTP transport implementation
WWW::Docker::API::System - System and daemon operations
WWW::Docker::API::Containers - Container management
WWW::Docker::API::Images - Image management
WWW::Docker::API::Networks - Network management
WWW::Docker::API::Volumes - Volume management
WWW::Docker::API::Exec - Execute commands in containers
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.