NAME

Podman::Container - Create and control container.

SYNOPSIS

# Create container
use Podman::Container qw(create);
my $container = create('nginx', 'docker.io/library/nginx');

# Start container
$container->start;

# Stop container
$container->stop;

# Kill container
$container->kill;

DESCRIPTION

Inheritance

Podman::Container
    isa Podman::Client

Podman::Container provides functionallity to create and control a container.

ATTRIBUTES

Podman::Container implements following attributes.

name

my $container = Podman::Container->new;
$container->name('docker.io/library/hello-world');

Unique image name or (short) identifier.

FUNCTIONS

Podman::Container implements the following functions, which can be imported individually.

create

use Podman::Container qw(create);
my $container = create(
    'nginx',
    'docker.io/library/nginx',
    tty         => 1,
    interactive => 1,
);

Create named container by given image <Podman::Image> object or name and additional create options.

METHODS

Podman::Container implements following methods.

inspect

my $info = $container->inspect;

Return advanced container information.

kill

$container->kill('SIGKILL');

Send signal to container, defaults to 'SIGTERM'.

pause

$container->pause;

Pause running container.

remove

my $force = 1;
$container->remove($force);

Remove stopped container. Takes additional argument force to remove even running container.

start

$container->start;

Start stopped container.

stats

my $stats = $container->stats;
for my $property (keys %{$stats}) {
    say $property . ': ' . $stats->{$property};
}

Return current usage statistics of running container.

stop

$container->stop;

Stop running container.

systemd

my $unit = $container->systemd;

Generate unit file to supervise container by systemd.

unpause

$container->unpause;

Resume paused container.

AUTHORS

    Tobias Schäfer, <tschaefer@blackox.org>

COPYRIGHT AND LICENSE

Copyright (C) 2022-2022, Tobias Schäfer.

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.