Module: Docker::API

Defined in:
lib/docker/api.rb,
lib/docker/api/tar.rb,
lib/docker/api/auth.rb,
lib/docker/api/body.rb,
lib/docker/api/path.rb,
lib/docker/api/query.rb,
lib/docker/api/client.rb,
lib/docker/api/config.rb,
lib/docker/api/errors.rb,
lib/docker/api/stream.rb,
lib/docker/api/context.rb,
lib/docker/api/session.rb,
lib/docker/api/version.rb,
lib/docker/api/platform.rb,
lib/docker/api/resource.rb,
lib/docker/api/response.rb,
lib/docker/api/transport.rb,
lib/docker/api/collection.rb,
lib/docker/api/connection.rb,
lib/docker/api/operations.rb,
lib/docker/api/transport/tcp.rb,
lib/docker/api/transport/tls.rb,
lib/docker/api/resources/exec.rb,
lib/docker/api/transport/base.rb,
lib/docker/api/transport/fake.rb,
lib/docker/api/transport/unix.rb,
lib/docker/api/resources/image.rb,
lib/docker/api/resources/volume.rb,
lib/docker/api/resources/network.rb,
lib/docker/api/collections/images.rb,
lib/docker/api/collections/system.rb,
lib/docker/api/collections/volumes.rb,
lib/docker/api/resources/container.rb,
lib/docker/api/collections/networks.rb,
lib/docker/api/transport/named_pipe.rb,
lib/docker/api/collections/containers.rb,
sig/docker/api/core.rbs,
sig/docker/api/operations.rbs

Overview

A Ruby client for the modern Docker Engine API.

The complete API surface is generated from Docker's own OpenAPI specification and reachable through Client#operations; an ergonomic hand-written layer of collections and resources sits on top of it.

Examples:

Talking to the local daemon

client = Docker::API::Client.new
client.system.info["ServerVersion"]

Two daemons at once, with no shared state

local = Docker::API::Client.new
build = Docker::API::Client.new(url: "tcp://build.internal:2376")

Defined Under Namespace

Modules: Auth, Body, Context, Path, Platform, Query, Stream, Tar, Transport Classes: BadRequest, Client, ClientError, Collection, Config, Conflict, Connection, ConnectionError, Container, Containers, Error, ExecResult, Forbidden, Image, Images, Network, Networks, NotFound, NotModified, Operations, Resource, Response, ServerError, Session, StreamError, System, TimeoutError, Unauthorized, VersionUnsupported, Volume, Volumes

Constant Summary collapse

STATUS_MAP =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Statuses with a specific meaning worth its own class. Anything else falls back to ClientError or ServerError by range.

{
  304 => NotModified,
  400 => BadRequest,
  401 => Unauthorized,
  403 => Forbidden,
  404 => NotFound,
  409 => Conflict,
}.freeze
VERSION =

The gem's own version.

Returns:

  • (String)
"0.3.0"
MAX_API_VERSION =

The newest Engine API version this gem vendors a specification for. Requests are never made against a version above this, even when the daemon offers one, because the generated layer only knows this shape.

Returns:

  • (String)
"1.55"
MIN_API_VERSION =

The oldest Engine API version this gem will talk to. Docker 20.10 is the oldest release still plausibly in service; below it, enough of the API differs that failing loudly beats failing mysteriously.

Returns:

  • (String)
"1.41"