NAME
API::Docker::Role::Entity::Image - Image operations, on the generated image types
VERSION
version 0.004
SYNOPSIS
my $docker = API::Docker->new;
# from list: an API::Docker::Type::ImageSummary
my ($image) = @{ $docker->images->list };
say $image->id;
say join ', ', @{ $image->repo_tags };
say $image->size;
$image->tag(repo => 'myrepo/app', tag => 'v1');
$image->remove(force => 1);
# from inspect: an API::Docker::Type::ImageInspect, where the same
# methods work and the extra build metadata is there
my $full = $image->inspect;
say $full->architecture;
say $full->os;
say $full->config->cmd->[0];
DESCRIPTION
The convenience methods of an image. This role is composed, at load time, into the two generated classes the daemon answers image requests with:
API::Docker::Type::ImageSummary -- one entry of
GET /images/json, what "list" in API::Docker::API::Images returnsAPI::Docker::Type::ImageInspect -- the body of
GET /images/{name}/json, what "inspect" in API::Docker::API::Images returns
Every method here forwards to API::Docker::API::Images with the image's own id and returns whatever that method returns; the options are that method's options, undocumented here on purpose so there is one place to correct when the engine's are found to be something else.
The fields differ between the two classes -- see "The two image shapes" in API::Docker::API::Images for the differences that have bitten.
Why the methods are a role applied to generated classes rather than a class of their own: "DESCRIPTION" in API::Docker::Role::Entity.
inspect
my $full = $image->inspect;
Get fresh image information. Returns an API::Docker::Type::ImageInspect whatever the invocant was, so this is also how a list entry is turned into the full shape.
history
my $history = $image->history;
Get image layer history. Delegates to "history" in API::Docker::API::Images, which hands back the daemon's ArrayRef unwrapped.
tag
$image->tag(repo => 'myrepo/app', tag => 'v1');
Tag the image. Addresses it by id ("id" in API::Docker::Type::ImageSummary / "id" in API::Docker::Type::ImageInspect, the same field on both), so this works on an image with no repo_tags at all.
remove
$image->remove(force => 1);
Remove the image.
SEE ALSO
API::Docker::API::Images - the operations these forward to
API::Docker::Type::ImageSummary - the fields
listreturnsAPI::Docker::Type::ImageInspect - the fields
inspectreturnsAPI::Docker::Role::Entity - why the methods live in a role
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-api-docker/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <getty@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.