API-Docker

 view release on metacpan or  search on metacpan

.claude/agents/api-docker-worker.md  view on Meta::CPAN

    - api-docker-core
    - api-docker-hazards
    - getty-perl-core
    - getty-perl-moo
    - kanban-issues-karr-ticket
    - getty-perl-pod
---

You are the api-docker-worker for **API::Docker**.

Implement, refactor, debug, and test the Perl side of this distribution. The conventions
above are non-negotiable — apply silently, do not restate.

**Where your lane ends.** You own how this distribution is built: `Role::HTTP`'s socket
handling and chunked reader, Moo composition, the entity roles composed onto the
generated types, `cpanfile`, dist
plumbing. You do not own what the Docker Engine accepts or answers. If the task turns on
daemon semantics — a wire format, a query-parameter meaning, a response shape, registry
auth, API version gating — stop and hand it to `api-docker-engine-worker`, which is
briefed with the Engine API reference and you are not. Guessing at daemon behavior from
the existing Perl is exactly how a wrong assumption gets cemented; the current

lib/API/Docker.pm  view on Meta::CPAN

  is      => 'lazy',
  builder => sub { API::Docker::API::Plugins->new(client => $_[0]) },
);


sub negotiate_version {
  my ($self, %opts) = @_;
  return if $self->_version_negotiated;
  return if defined $self->api_version;

  $log->debug("Auto-negotiating API version");
  my $version_info = $self->_request('GET', '/version',
    exists $opts{read_timeout} ? ( read_timeout => $opts{read_timeout} ) : (),
    exists $opts{connect_timeout} ? ( connect_timeout => $opts{connect_timeout} ) : (),
  );

  # The ApiVersion is put straight into every later request path (/v1.44/...),
  # so it has to be a JSON object carrying one of the form N.N -- nothing else
  # can be trusted there. Three ways a body fails that, each measured against a
  # fake daemon: a non-object body reached strict refs ('garbage' died with
  # "Can't use string as a HASH ref", [1] with "Not a HASH reference"); an

lib/API/Docker.pm  view on Meta::CPAN


  croak __PACKAGE__ . '->negotiate_version: GET /version must answer with a '
    . 'JSON object carrying an ApiVersion of the form N.N (e.g. "1.44"); got '
    . $got
    unless ref $version_info eq 'HASH'
      && defined $version_info->{ApiVersion}
      && !ref $version_info->{ApiVersion}
      && $version_info->{ApiVersion} =~ /^\d+\.\d+$/;

  $self->_set_api_version($version_info->{ApiVersion});
  $log->debugf("Negotiated API version: %s", $version_info->{ApiVersion});
  $self->_version_negotiated(1);
}


around _request => sub {
  my ($orig, $self, $method, $path, %opts) = @_;

  # Auto-negotiate before any versioned request, but not for /version itself.
  # The triggering request's own bounds are handed to it: the negotiation is a
  # pre-flight the caller never wrote, and a caller who asked for a bound and

lib/API/Docker/Role/HTTP.pm  view on Meta::CPAN

);

sub _build__socket {
  my ($self) = @_;
  my $host    = $self->host;
  my $pending = $self->_pending_connect;
  my $timeout = $pending ? $pending->{timeout} : undef;

  if ($host =~ m{^unix://(.+)$}) {
    my $path = $1;
    $log->debugf("Connecting to Unix socket: %s", $path);
    my $sock = IO::Socket::UNIX->new(
      Peer => $path,
      Type => SOCK_STREAM,
      $timeout ? (Timeout => $timeout) : (),
    );
    unless ($sock) {
      # Asked before anything else can touch $@ or $!, which is the whole of
      # the evidence; see _connect_expired.
      $self->_croak_connect_timeout($pending, 'unix://' . $path)
        if $self->_connect_expired($timeout);
      croak "Cannot connect to Unix socket $path: $!";
    }
    return $sock;
  }
  elsif ($host =~ m{^tcp://([^:]+):(\d+)$}) {
    my ($addr, $port) = ($1, $2);

    unless ($self->tls) {
      $log->debugf("Connecting to TCP %s:%s", $addr, $port);
      my $sock = IO::Socket::INET->new(
        PeerAddr => $addr,
        PeerPort => $port,
        Proto    => 'tcp',
        $timeout ? (Timeout => $timeout) : (),
      );
      unless ($sock) {
        $self->_croak_connect_timeout($pending, $addr . ':' . $port)
          if $self->_connect_expired($timeout);
        croak "Cannot connect to $addr:$port: $!";
      }
      return $sock;
    }

    # Built before the connection is opened: a cert_path that names nothing,
    # or half a client certificate, is a configuration mistake and the caller
    # should hear about it as one rather than as a handshake failure.
    my %ssl = $self->_ssl_options($addr);

    $log->debugf("Connecting to TCP %s:%s over TLS (verification %s)",
      $addr, $port, $self->tls_insecure ? 'off' : 'on');
    my $sock = IO::Socket::SSL->new(
      PeerAddr => $addr,
      PeerPort => $port,
      Proto    => 'tcp',
      $timeout ? (Timeout => $timeout) : (),
      %ssl,
    );
    unless ($sock) {
      $self->_croak_connect_timeout($pending, $addr . ':' . $port . ' (TLS)')

lib/API/Docker/Role/HTTP.pm  view on Meta::CPAN

      # only the keys are sorted.
      for my $item (ref $v eq 'ARRAY' ? @$v : ($v)) {
        next unless defined $item;
        push @pairs, _uri_encode($k) . '='
          . _uri_encode(ref $item eq 'HASH' ? encode_json($item) : $item);
      }
    }
    $url_path .= '?' . join('&', @pairs) if @pairs;
  }

  $log->debugf("%s %s", $method, $url_path);

  my $request = "$method $url_path HTTP/1.1\r\n";
  $request .= "Host: localhost\r\n";
  $request .= "Connection: close\r\n";
  $request .= "User-Agent: API-Docker\r\n";

  if (defined $body_content) {
    $request .= "Content-Type: $content_type\r\n";
    $request .= "Content-Length: " . length($body_content) . "\r\n";
  }

lib/API/Docker/Role/HTTP.pm  view on Meta::CPAN

  if (!$ok && defined $write_error) {
    # The daemon sent nothing usable and the write had failed: the write is
    # the cause, and the endpoint belongs in the message.
    croak 'Docker API request to '.$endpoint.' failed: could not send the '
      .'request ('.$write_error.') and no response followed';
  }
  die $err unless $ok;

  my ($status_code, $status_text, $headers, $body, $summary) = @$response;

  $log->debugf("Response: %s %s", $status_code, $status_text);

  # The status line and the response headers are metadata the return value
  # cannot carry: it is the decoded body and nothing else, so 204 and 304 are
  # both undef and a header holding the payload -- HEAD
  # /containers/{id}/archive answers with an empty body and
  # X-Docker-Container-Path-Stat -- is unreachable. They go into a hash the
  # caller supplies, so no existing caller's return shape changes. Filled
  # before the croak below, so an eval'ing caller can still read the status.
  if (my $out = $opts{response}) {
    %$out = (

lib/API/Docker/Type/ContainerdInfo.pm  view on Meta::CPAN

API::Docker::Type::ContainerdInfo - Information for connecting to the containerd instance that is used by the daemon

=head1 VERSION

version 0.006

=head1 DESCRIPTION

Generated from the C<ContainerdInfo> definition of C<spec/v1.51.yaml>.

This is included for debugging purposes only.

=head2 address

The address of the containerd socket.

=head2 namespaces

The namespaces that the daemon uses for running containers and plugins in
containerd. These namespaces can be configured in the daemon configuration,
and are considered to be used exclusively by the daemon, Tampering with the

lib/API/Docker/Type/Plugin/Config.pm  view on Meta::CPAN

=head2 mounts

Undocumented upstream. The mounts the plugin declares.
L<API::Docker::Type::Plugin/settings> carries the same list as it stands
after a user has changed it. See L<API::Docker::Type::PluginMount>.

=head2 env

Undocumented upstream. The environment variables the plugin declares, each
an object with its own description and value: the swagger's example is a
single C<DEBUG>, "if set, prints debug messages", currently C<"0">.
L<API::Docker::Type::Plugin::Settings/env> carries the same variables as
bare C<NAME=value> strings. See L<API::Docker::Type::PluginEnv>.

=head2 args

Undocumented upstream. The plugin's command line as one named item --
C<args>, "command line arguments", in the swagger's example -- not one item
per argument. See L<API::Docker::Type::Plugin::Config::Args>.

=head2 rootfs

lib/API/Docker/Type/PluginEnv.pm  view on Meta::CPAN

=head1 VERSION

version 0.006

=head1 DESCRIPTION

Generated from the C<PluginEnv> definition of C<spec/v1.51.yaml>, which the
swagger leaves undescribed. Nothing in C<paths:> reaches it either; it is
one entry of C<Plugin.Config.Env>. None of its four fields is described, but
the example the swagger gives for that field shows all four at once: C<Name>
C<"DEBUG">, C<Description> C<"If set, prints debug messages">, C<Settable>
C<null> and C<Value> C<"0">.

=head2 name

Undocumented upstream. The variable's name, C<"DEBUG"> in that example. The
swagger lists this field as required; nothing here enforces that, see
L<API::Docker::Type/C<since> is documentation>.

=head2 description

Undocumented upstream. What setting it does, C<"If set, prints debug
messages"> in that example. The swagger lists this field as required;
nothing here enforces that, see L<API::Docker::Type/C<since> is
documentation>.

=head2 settable

Undocumented upstream. An array of strings, C<null> in that example, and the
swagger never says what they hold. What a user changes on an installed
plugin goes in through C<POST /plugins/{name}/set> and comes back out under
L<API::Docker::Type::Plugin/settings>. The swagger lists this field as

lib/API/Docker/Type/SystemInfo.pm  view on Meta::CPAN


docker pids_limit => Bool;


docker oom_kill_disable => Bool;


docker ipv4_forwarding => Bool, wire => 'IPv4Forwarding';


docker debug => Bool;


docker n_fd => Int;


docker n_goroutines => Int;


docker system_time => Str;

lib/API/Docker/Type/SystemInfo.pm  view on Meta::CPAN

=head2 oom_kill_disable

Indicates if OOM killer disable is supported on the host.

=head2 ipv4_forwarding

Indicates IPv4 forwarding is enabled. Serialised as C<IPv4Forwarding> --
spelled out, because deriving it from the Perl name would produce
C<Ipv4Forwarding>.

=head2 debug

Indicates if the daemon is running in debug-mode / with debug-level logging
enabled.

=head2 n_fd

The total number of file Descriptors in use by the daemon process.

This information is only returned if debug-mode is enabled.

=head2 n_goroutines

The number of goroutines that currently exist.

This information is only returned if debug-mode is enabled.

=head2 system_time

Current system-time in L<RFC 3339|https://www.ietf.org/rfc/rfc3339.txt>
format with nano-seconds.

=head2 logging_driver

The logging driver to use as a default for new containers.

lib/API/Docker/Type/TaskSpec/ContainerSpec/DNSConfig.pm  view on Meta::CPAN

=head2 nameservers

The IP addresses of the name servers.

=head2 search

A search list for host-name lookup.

=head2 options

A list of internal resolver variables to be modified (e.g., C<debug>,
C<ndots:3>, etc.).

=head1 SUPPORT

=head2 Issues

Please report bugs and feature requests at
L<https://github.com/Getty/p5-api-docker/issues>.

=head1 CONTRIBUTING

misc/agent-context/.claude/agents/api-docker-worker.md  view on Meta::CPAN

    - api-docker-core
    - api-docker-hazards
    - getty-perl-core
    - getty-perl-moo
    - kanban-issues-karr-ticket
    - getty-perl-pod
---

You are the api-docker-worker for **API::Docker**.

Implement, refactor, debug, and test the Perl side of this distribution. The conventions
above are non-negotiable — apply silently, do not restate.

**Where your lane ends.** You own how this distribution is built: `Role::HTTP`'s socket
handling and chunked reader, Moo composition, the entity roles composed onto the
generated types, `cpanfile`, dist
plumbing. You do not own what the Docker Engine accepts or answers. If the task turns on
daemon semantics — a wire format, a query-parameter meaning, a response shape, registry
auth, API version gating — stop and hand it to `api-docker-engine-worker`, which is
briefed with the Engine API reference and you are not. Guessing at daemon behavior from
the existing Perl is exactly how a wrong assumption gets cemented; the current

misc/agent-context/.claude/skills/docker-engine-api/SKILL.md  view on Meta::CPAN

---
name: docker-engine-api
description: "Use when implementing, testing, or debugging a Docker Engine HTTP API client: socket/remote transport, API negotiation, container lifecycle, attach/exec/log framing, progress streams, image auth, events/stats, resource policy, archives,...
---

# Docker Engine HTTP API

Use this skill when software speaks directly to the Engine API instead of delegating the operation to Docker CLI/Compose. Documentation review: **2026-10-09**. This is a protocol and client-engineering guide, not an exhaustive endpoint dump or a repl...

## Acquire the contract first

Read the [compatibility policy](references/compatibility-policy.md) and [version negotiation](references/transport/version-negotiation.md). Record target implementation, endpoint/transport, server API range, the client's implemented API range, and re...

misc/agent-context/.claude/skills/getty-perl-core/SKILL.md  view on Meta::CPAN

## Configuration and DBIC

- **Config comes from env vars prefixed with the project name** (`$ENV{MYPROJECT_TIME_ZONE}`), each with a default in code. Many attributes of that shape → a generator sub that wraps `has`, not N copied declarations.
- **DBIx::Class / DBIO result classes** (columns, NonMoose classes): read [references/dbic.md](references/dbic.md) before editing one.

## Style

- **2-space indentation** — not 4, not tabs.
- **Trailing comma after the last element** of every multi-line list, hash or call.
- **Section long files with a figlet banner** comment (`standard`, `slant`, `small`, `banner`); short file or no figlet → a `#### <Name>` rule.
- **Debug with `DDP`** (`Data::Printer`), never `Data::Dumper` in shipped code. Live debug calls go before commit; **commented-out ones stay** (`#use DDP; p($res);`) — they mark where debugging was needed.

## cpanfile

- **Requirements live in `cpanfile`**, not `dist.ini` prereq blocks.
- **`requires 'Module::Name';`** — omit the version when unpinned, never `'0'`. A version means "or higher": `requires 'Foo', '5.0';`, never `'>= 5.0'`.
- **Alphabetical**, phase blocks (`on test => sub {...}`) at the end.

### Getty-authored dependencies — CRITICAL

`[@Author::GETTY]` keeps a repo's `$VERSION` at the **next, unreleased** version (`0.402` while CPAN has `0.401`) — a sibling checkout is always one ahead of CPAN.

misc/agent-context/.claude/skills/perl-release-dist-ini/SKILL.md  view on Meta::CPAN

---
name: perl-release-dist-ini
description: "Load when reading, editing or debugging any dist.ini — plugins, bundles such as Author::GETTY, version config, prereqs."
user-invocable: false
allowed-tools: Read, Grep
model: sonnet
---

Generic Dist::Zilla dist.ini reference — applies to any distribution regardless of author bundle.
For `[@Author::GETTY]`-specific conventions (next-version semantics, POD commands, bundle options), the getty-perl-release-author-getty skill applies additionally.

When analyzing dist.ini:

t/fixtures/container_inspect.json  view on Meta::CPAN

    "CpuPercent": 0,
    "IOMaximumIOps": 0,
    "IOMaximumBandwidth": 0,
    "MaskedPaths": [
      "/proc/acpi",
      "/proc/asound",
      "/proc/interrupts",
      "/proc/kcore",
      "/proc/keys",
      "/proc/latency_stats",
      "/proc/sched_debug",
      "/proc/scsi",
      "/proc/timer_list",
      "/proc/timer_stats",
      "/sys/devices/virtual/powercap",
      "/sys/firmware",
      "/sys/devices/system/cpu/cpu0/thermal_throttle",
      "/sys/devices/system/cpu/cpu1/thermal_throttle",
      "/sys/devices/system/cpu/cpu2/thermal_throttle",
      "/sys/devices/system/cpu/cpu3/thermal_throttle"
    ],



( run in 1.055 second using v1.01-cache-2.11-cpan-c32d3c3b8f1 )