The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Podman::Containers

Provides the operations against containers for a Podman service.

 my $Containers = Podman::Containers->new(Client => Podman::Client->new());
 
 # Display names and Ids of available containers.
 for my $Container (@{ $Containers->list() }) {
     my $Info = $Container->Inspect();
     printf "%s: %s\n", $Container->Id, $Info->{RepoTags}->[0];
 }

Attributes

has 'Client'; #23

Podman::Client API connector.

Methods

sub List($Self); #44

List all local stored containers.

 use Podman::Client;
 
 my $Containers = Podman::Containers->new(Client => Podman::Client->new());
 
 my $List = $Containers->List();
 is(ref $List, 'ARRAY', 'Containers list ok.');
 
 if ($List) {
     is(ref $List->[0], 'Podman::Container', 'Containers list items ok.');
 }