Class: Docker::API::Operations

Inherits:
Object
  • Object
show all
Defined in:
lib/docker/api/operations.rb,
sig/docker/api/operations.rbs

Overview

Every operation the Docker Engine API defines, one method each.

This layer is generated from Docker's own specification, so it is complete by construction: if the daemon documents an endpoint, there is a method for it, with every parameter that endpoint accepts. It is also public API rather than an escape hatch -- reach for it directly whenever the ergonomic layer has not grown sugar for what you need.

Methods take keyword arguments named after the specification's parameters, return a Response, and raise a Error subclass for any status the endpoint does not document as success.

Examples:

Calling an endpoint with no ergonomic wrapper

client.operations.container_prune(filters: { "until" => ["24h"] })

Streaming, by passing a block

client.operations.system_events { |chunk| puts chunk }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Operations

Returns a new instance of Operations.

Parameters:



38
39
40
# File 'lib/docker/api/operations.rb', line 38

def initialize(connection)
  @connection = connection
end

Instance Attribute Details

#connectionDocker::API::Connection (readonly)

Returns the connection in use.

Returns:



43
44
45
# File 'lib/docker/api/operations.rb', line 43

def connection
  @connection
end

Instance Method Details

#build_prune {|chunk| ... } ⇒ Docker::API::Response

Delete builder cache

Engine API: POST /build/prune

keep for cache (sent to the daemon as 'reserved-space') allowed to keep for cache (sent to the daemon as 'max-used-space') after pruning (sent to the daemon as 'min-free-space') map[string][]string) to process on the list of build cache objects.

Parameters:

  • reserved_space (Integer, nil)

    Amount of disk space in bytes to

  • max_used_space (Integer, nil)

    Maximum amount of disk space

  • min_free_space (Integer, nil)

    Target amount of free disk space

  • all (Boolean, nil)

    Remove all types of build cache

  • filters (String, nil)

    A JSON encoded value of the filters (a

  • reserved_space: (Integer, nil)
  • max_used_space: (Integer, nil)
  • min_free_space: (Integer, nil)
  • all: (Boolean, nil)
  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
# File 'lib/docker/api/operations.rb', line 1022

def build_prune(reserved_space: nil, max_used_space: nil, min_free_space: nil, all: nil, filters: nil, &block)
  connection.request(
    :post,
    "/build/prune",
    query: {
      "reserved-space" => reserved_space,
      "max-used-space" => max_used_space,
      "min-free-space" => min_free_space,
      "all" => all,
      "filters" => filters,
    },
    expects: [200],
    operation: "build_prune",
    &block
  )
end

#config_create {|chunk| ... } ⇒ Docker::API::Response

Create a config

Engine API: POST /configs/create

object

Parameters:

  • body (Hash, nil)

    (body parameter 'body' in the API specification)

  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



57
58
59
60
61
62
63
64
65
66
# File 'lib/docker/api/operations.rb', line 57

def config_create(body: nil, &block)
  connection.request(
    :post,
    "/configs/create",
    body: body,
    expects: [201],
    operation: "config_create",
    &block
  )
end

#config_delete {|chunk| ... } ⇒ Docker::API::Response

Delete a config

Engine API: DELETE /configs/id

Parameters:

  • id (String)

    ID of the config

  • id: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



79
80
81
82
83
84
85
86
87
# File 'lib/docker/api/operations.rb', line 79

def config_delete(id:, &block)
  connection.request(
    :delete,
    "/configs/#{Path.escape(id)}",
    expects: [204],
    operation: "config_delete",
    &block
  )
end

#config_inspect {|chunk| ... } ⇒ Docker::API::Response

Inspect a config

Engine API: GET /configs/id

Parameters:

  • id (String)

    ID of the config

  • id: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



100
101
102
103
104
105
106
107
108
# File 'lib/docker/api/operations.rb', line 100

def config_inspect(id:, &block)
  connection.request(
    :get,
    "/configs/#{Path.escape(id)}",
    expects: [200],
    operation: "config_inspect",
    &block
  )
end

#config_list {|chunk| ... } ⇒ Docker::API::Response

List configs

Engine API: GET /configs

map[string][]string) to process on the configs list.

Parameters:

  • filters (String, nil)

    A JSON encoded value of the filters (a

  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



121
122
123
124
125
126
127
128
129
130
# File 'lib/docker/api/operations.rb', line 121

def config_list(filters: nil, &block)
  connection.request(
    :get,
    "/configs",
    query: { "filters" => filters },
    expects: [200],
    operation: "config_list",
    &block
  )
end

#config_update {|chunk| ... } ⇒ Docker::API::Response

Update a Config

Engine API: POST /configs/id/update

updated. This is required to avoid conflicting writes. only the Labels field can be updated. All other fields must remain unchanged from the [ConfigInspect endpoint](#ope... (body parameter 'body' in the API specification)

Parameters:

  • id (String)

    The ID or name of the config

  • version (Integer)

    The version number of the config object being

  • body (Hash, nil)

    The spec of the config to update. Currently,

  • id: (String)
  • version: (Integer)
  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



150
151
152
153
154
155
156
157
158
159
160
# File 'lib/docker/api/operations.rb', line 150

def config_update(id:, version:, body: nil, &block)
  connection.request(
    :post,
    "/configs/#{Path.escape(id)}/update",
    query: { "version" => version },
    body: body,
    expects: [200],
    operation: "config_update",
    &block
  )
end

#container_archive {|chunk| ... } ⇒ Docker::API::Response

Get an archive of a filesystem resource in a container

Get a tar archive of a resource in the filesystem of container id.

Engine API: GET /containers/id/archive

Parameters:

  • id (String)

    ID or name of the container

  • path (String)

    Resource in the container’s filesystem to archive.

  • id: (String)
  • path: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



176
177
178
179
180
181
182
183
184
185
# File 'lib/docker/api/operations.rb', line 176

def container_archive(id:, path:, &block)
  connection.request(
    :get,
    "/containers/#{Path.escape(id)}/archive",
    query: { "path" => path },
    expects: [200],
    operation: "container_archive",
    &block
  )
end

#container_archive_info {|chunk| ... } ⇒ Docker::API::Response

Get information about files in a container

A response header X-Docker-Container-Path-Stat is returned, containing a base64 - encoded JSON object with some filesystem header information about the path.

Engine API: HEAD /containers/id/archive

Parameters:

  • id (String)

    ID or name of the container

  • path (String)

    Resource in the container’s filesystem to archive.

  • id: (String)
  • path: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



203
204
205
206
207
208
209
210
211
212
# File 'lib/docker/api/operations.rb', line 203

def container_archive_info(id:, path:, &block)
  connection.request(
    :head,
    "/containers/#{Path.escape(id)}/archive",
    query: { "path" => path },
    expects: [200],
    operation: "container_archive_info",
    &block
  )
end

#container_attach {|chunk| ... } ⇒ Docker::API::Response

Attach to a container

Attach to a container to read its output or send it input. You can attach to the same container multiple times and you can reattach to containers that have been detached.

Engine API: POST /containers/id/attach

a container.Format is a single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^, [, ,... (sent to the daemon as 'detachKeys') request was made onwards. hijacking

Parameters:

  • id (String)

    ID or name of the container

  • detach_keys (String, nil)

    Override the key sequence for detaching

  • logs (Boolean, nil)

    Replay previous logs from the container.

  • stream (Boolean, nil)

    Stream attached streams from the time the

  • stdin (Boolean, nil)

    Attach to stdin

  • stdout (Boolean, nil)

    Attach to stdout

  • stderr (Boolean, nil)

    Attach to stderr

  • id: (String)
  • detach_keys: (String, nil)
  • logs: (Boolean, nil)
  • stream: (Boolean, nil)
  • stdin: (Boolean, nil)
  • stdout: (Boolean, nil)
  • stderr: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/docker/api/operations.rb', line 241

def container_attach(id:, detach_keys: nil, logs: nil, stream: nil, stdin: nil, stdout: nil, stderr: nil, &block)
  connection.request(
    :post,
    "/containers/#{Path.escape(id)}/attach",
    query: {
      "detachKeys" => detach_keys,
      "logs" => logs,
      "stream" => stream,
      "stdin" => stdin,
      "stdout" => stdout,
      "stderr" => stderr,
    },
    expects: [200],
    operation: "container_attach",
    &block
  )
end

#container_attach_websocket {|chunk| ... } ⇒ Docker::API::Response

Attach to a container via a websocket

Engine API: GET /containers/id/attach/ws

a container.Format is a single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^, [, ,,... (sent to the daemon as 'detachKeys') hijacking

Parameters:

  • id (String)

    ID or name of the container

  • detach_keys (String, nil)

    Override the key sequence for detaching

  • logs (Boolean, nil)

    Return logs

  • stream (Boolean, nil)

    Return stream

  • stdin (Boolean, nil)

    Attach to stdin

  • stdout (Boolean, nil)

    Attach to stdout

  • stderr (Boolean, nil)

    Attach to stderr

  • id: (String)
  • detach_keys: (String, nil)
  • logs: (Boolean, nil)
  • stream: (Boolean, nil)
  • stdin: (Boolean, nil)
  • stdout: (Boolean, nil)
  • stderr: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/docker/api/operations.rb', line 281

def container_attach_websocket(id:, detach_keys: nil, logs: nil, stream: nil, stdin: nil, stdout: nil, stderr: nil, &block)
  connection.request(
    :get,
    "/containers/#{Path.escape(id)}/attach/ws",
    query: {
      "detachKeys" => detach_keys,
      "logs" => logs,
      "stream" => stream,
      "stdin" => stdin,
      "stdout" => stdout,
      "stderr" => stderr,
    },
    expects: [200],
    operation: "container_attach_websocket",
    &block
  )
end

#container_changes {|chunk| ... } ⇒ Docker::API::Response

Get changes on a container’s filesystem

Returns which files in a container's filesystem have been added, deleted, or modified. The Kind of modification can be one of:

Engine API: GET /containers/id/changes

Parameters:

  • id (String)

    ID or name of the container

  • id: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



312
313
314
315
316
317
318
319
320
# File 'lib/docker/api/operations.rb', line 312

def container_changes(id:, &block)
  connection.request(
    :get,
    "/containers/#{Path.escape(id)}/changes",
    expects: [200],
    operation: "container_changes",
    &block
  )
end

#container_create {|chunk| ... } ⇒ Docker::API::Response

Create a container

Engine API: POST /containers/create

specification) Must match /?[a-zA-Z0-9][a-zA-Z0-9_.-]+. os[/arch[/variant]] used for image lookup.

Parameters:

  • body (Hash)

    Container to create (body parameter 'body' in the API

  • name (String, nil)

    Assign the specified name to the container.

  • platform (String, nil)

    Platform in the format

  • body: (Hash[String, untyped], String, IO)
  • name: (String, nil)
  • platform: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



339
340
341
342
343
344
345
346
347
348
349
# File 'lib/docker/api/operations.rb', line 339

def container_create(body:, name: nil, platform: nil, &block)
  connection.request(
    :post,
    "/containers/create",
    query: { "name" => name, "platform" => platform },
    body: body,
    expects: [201],
    operation: "container_create",
    &block
  )
end

#container_delete {|chunk| ... } ⇒ Docker::API::Response

Remove a container

Engine API: DELETE /containers/id

container. removing it. container.

Parameters:

  • id (String)

    ID or name of the container

  • v (Boolean, nil)

    Remove anonymous volumes associated with the

  • force (Boolean, nil)

    If the container is running, kill it before

  • link (Boolean, nil)

    Remove the specified link associated with the

  • id: (String)
  • v: (Boolean, nil)
  • force: (Boolean, nil)
  • link: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



369
370
371
372
373
374
375
376
377
378
# File 'lib/docker/api/operations.rb', line 369

def container_delete(id:, v: nil, force: nil, link: nil, &block)
  connection.request(
    :delete,
    "/containers/#{Path.escape(id)}",
    query: { "v" => v, "force" => force, "link" => link },
    expects: [204],
    operation: "container_delete",
    &block
  )
end

#container_exec {|chunk| ... } ⇒ Docker::API::Response

Create an exec instance

Run a command inside a running container.

Engine API: POST /containers/id/exec

the API specification)

Parameters:

  • id (String)

    ID or name of container

  • body (Hash)

    Exec configuration (body parameter 'execConfig' in

  • id: (String)
  • body: (Hash[String, untyped], String, IO)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



918
919
920
921
922
923
924
925
926
927
# File 'lib/docker/api/operations.rb', line 918

def container_exec(id:, body:, &block)
  connection.request(
    :post,
    "/containers/#{Path.escape(id)}/exec",
    body: body,
    expects: [201],
    operation: "container_exec",
    &block
  )
end

#container_export {|chunk| ... } ⇒ Docker::API::Response

Export a container

Export the contents of a container as a tarball.

Engine API: GET /containers/id/export

Parameters:

  • id (String)

    ID or name of the container

  • id: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



392
393
394
395
396
397
398
399
400
# File 'lib/docker/api/operations.rb', line 392

def container_export(id:, &block)
  connection.request(
    :get,
    "/containers/#{Path.escape(id)}/export",
    expects: [200],
    operation: "container_export",
    &block
  )
end

#container_inspect {|chunk| ... } ⇒ Docker::API::Response

Inspect a container

Return low-level information about a container.

Engine API: GET /containers/id/json

SizeRw and SizeRootFs

Parameters:

  • id (String)

    ID or name of the container

  • size (Boolean, nil)

    Return the size of container as fields

  • id: (String)
  • size: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



416
417
418
419
420
421
422
423
424
425
# File 'lib/docker/api/operations.rb', line 416

def container_inspect(id:, size: nil, &block)
  connection.request(
    :get,
    "/containers/#{Path.escape(id)}/json",
    query: { "size" => size },
    expects: [200],
    operation: "container_inspect",
    &block
  )
end

#container_kill {|chunk| ... } ⇒ Docker::API::Response

Kill a container

Send a POSIX signal to a container, defaulting to killing to the container.

Engine API: POST /containers/id/kill

integer or string (e.g. SIGINT).

Parameters:

  • id (String)

    ID or name of the container

  • signal (String, nil)

    Signal to send to the container as an

  • id: (String)
  • signal: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



443
444
445
446
447
448
449
450
451
452
# File 'lib/docker/api/operations.rb', line 443

def container_kill(id:, signal: nil, &block)
  connection.request(
    :post,
    "/containers/#{Path.escape(id)}/kill",
    query: { "signal" => signal },
    expects: [204],
    operation: "container_kill",
    &block
  )
end

#container_list {|chunk| ... } ⇒ Docker::API::Response

List containers

Returns a list of containers. For details on the format, see the inspect endpoint.

Engine API: GET /containers/json

running containers are shown. containers, including non-running ones. SizeRw and SizeRootFs. encoded as JSON (a map[string][]string). For example, {"status": ["paused"]} will only return paused containers.

Parameters:

  • all (Boolean, nil)

    Return all containers. By default, only

  • limit (Integer, nil)

    Return this number of most recently created

  • size (Boolean, nil)

    Return the size of container as fields

  • filters (String, nil)

    Filters to process on the container list,

  • all: (Boolean, nil)
  • limit: (Integer, nil)
  • size: (Boolean, nil)
  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



475
476
477
478
479
480
481
482
483
484
# File 'lib/docker/api/operations.rb', line 475

def container_list(all: nil, limit: nil, size: nil, filters: nil, &block)
  connection.request(
    :get,
    "/containers/json",
    query: { "all" => all, "limit" => limit, "size" => size, "filters" => filters },
    expects: [200],
    operation: "container_list",
    &block
  )
end

#container_logs {|chunk| ... } ⇒ Docker::API::Response

Get container logs

Get stdout and stderr logs from a container.

Engine API: GET /containers/id/logs

timestamp UNIX timestamp (sent to the daemon as 'until') end of the logs. Specify as an integer or all to output all log lines.

Parameters:

  • id (String)

    ID or name of the container

  • follow (Boolean, nil)

    Keep connection after returning logs.

  • stdout (Boolean, nil)

    Return logs from stdout

  • stderr (Boolean, nil)

    Return logs from stderr

  • since (Integer, nil)

    Only return logs since this time, as a UNIX

  • until_ (Integer, nil)

    Only return logs before this time, as a

  • timestamps (Boolean, nil)

    Add timestamps to every log line

  • tail (String, nil)

    Only return this number of log lines from the

  • id: (String)
  • follow: (Boolean, nil)
  • stdout: (Boolean, nil)
  • stderr: (Boolean, nil)
  • since: (Integer, nil)
  • until_: (Integer, nil)
  • timestamps: (Boolean, nil)
  • tail: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
# File 'lib/docker/api/operations.rb', line 508

def container_logs(
  id:,
  follow: nil,
  stdout: nil,
  stderr: nil,
  since: nil,
  until_: nil,
  timestamps: nil,
  tail: nil,
  &block
)
  connection.request(
    :get,
    "/containers/#{Path.escape(id)}/logs",
    query: {
      "follow" => follow,
      "stdout" => stdout,
      "stderr" => stderr,
      "since" => since,
      "until" => until_,
      "timestamps" => timestamps,
      "tail" => tail,
    },
    expects: [200],
    operation: "container_logs",
    &block
  )
end

#container_pause {|chunk| ... } ⇒ Docker::API::Response

Pause a container

Use the freezer cgroup to suspend all processes in a container.

Engine API: POST /containers/id/pause

Parameters:

  • id (String)

    ID or name of the container

  • id: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



549
550
551
552
553
554
555
556
557
# File 'lib/docker/api/operations.rb', line 549

def container_pause(id:, &block)
  connection.request(
    :post,
    "/containers/#{Path.escape(id)}/pause",
    expects: [204],
    operation: "container_pause",
    &block
  )
end

#container_prune {|chunk| ... } ⇒ Docker::API::Response

Delete stopped containers

Engine API: POST /containers/prune

encoded as JSON (a map[string][]string).

Parameters:

  • filters (String, nil)

    Filters to process on the prune list,

  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



569
570
571
572
573
574
575
576
577
578
# File 'lib/docker/api/operations.rb', line 569

def container_prune(filters: nil, &block)
  connection.request(
    :post,
    "/containers/prune",
    query: { "filters" => filters },
    expects: [200],
    operation: "container_prune",
    &block
  )
end

#container_rename {|chunk| ... } ⇒ Docker::API::Response

Rename a container

Engine API: POST /containers/id/rename

Parameters:

  • id (String)

    ID or name of the container

  • name (String)

    New name for the container

  • id: (String)
  • name: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



592
593
594
595
596
597
598
599
600
601
# File 'lib/docker/api/operations.rb', line 592

def container_rename(id:, name:, &block)
  connection.request(
    :post,
    "/containers/#{Path.escape(id)}/rename",
    query: { "name" => name },
    expects: [204],
    operation: "container_rename",
    &block
  )
end

#container_resize {|chunk| ... } ⇒ Docker::API::Response

Resize a container TTY

Resize the TTY for a container.

Engine API: POST /containers/id/resize

Parameters:

  • id (String)

    ID or name of the container

  • h (Integer)

    Height of the TTY session in characters

  • w (Integer)

    Width of the TTY session in characters

  • id: (String)
  • h: (Integer)
  • w: (Integer)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



617
618
619
620
621
622
623
624
625
626
# File 'lib/docker/api/operations.rb', line 617

def container_resize(id:, h:, w:, &block)
  connection.request(
    :post,
    "/containers/#{Path.escape(id)}/resize",
    query: { "h" => h, "w" => w },
    expects: [200],
    operation: "container_resize",
    &block
  )
end

#container_restart {|chunk| ... } ⇒ Docker::API::Response

Restart a container

Engine API: POST /containers/id/restart

integer or string (e.g. SIGINT). container

Parameters:

  • id (String)

    ID or name of the container

  • signal (String, nil)

    Signal to send to the container as an

  • t (Integer, nil)

    Number of seconds to wait before killing the

  • id: (String)
  • signal: (String, nil)
  • t: (Integer, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



642
643
644
645
646
647
648
649
650
651
# File 'lib/docker/api/operations.rb', line 642

def container_restart(id:, signal: nil, t: nil, &block)
  connection.request(
    :post,
    "/containers/#{Path.escape(id)}/restart",
    query: { "signal" => signal, "t" => t },
    expects: [204],
    operation: "container_restart",
    &block
  )
end

#container_start {|chunk| ... } ⇒ Docker::API::Response

Start a container

Engine API: POST /containers/id/start

a container. Format is a single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^, [, ,... (sent to the daemon as 'detachKeys')

Parameters:

  • id (String)

    ID or name of the container

  • detach_keys (String, nil)

    Override the key sequence for detaching

  • id: (String)
  • detach_keys: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



668
669
670
671
672
673
674
675
676
677
# File 'lib/docker/api/operations.rb', line 668

def container_start(id:, detach_keys: nil, &block)
  connection.request(
    :post,
    "/containers/#{Path.escape(id)}/start",
    query: { "detachKeys" => detach_keys },
    expects: [204],
    operation: "container_start",
    &block
  )
end

#container_stats {|chunk| ... } ⇒ Docker::API::Response

Get container stats based on resource usage

This endpoint returns a live stream of a container’s resource usage statistics.

Engine API: GET /containers/id/stats

be output once and then it will disconnect. for 2 cycles. Must be used with stream=false. (sent to the daemon as 'one-shot')

Parameters:

  • id (String)

    ID or name of the container

  • stream (Boolean, nil)

    Stream the output. If false, the stats will

  • one_shot (Boolean, nil)

    Only get a single stat instead of waiting

  • id: (String)
  • stream: (Boolean, nil)
  • one_shot: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



697
698
699
700
701
702
703
704
705
706
# File 'lib/docker/api/operations.rb', line 697

def container_stats(id:, stream: nil, one_shot: nil, &block)
  connection.request(
    :get,
    "/containers/#{Path.escape(id)}/stats",
    query: { "stream" => stream, "one-shot" => one_shot },
    expects: [200],
    operation: "container_stats",
    &block
  )
end

#container_stop {|chunk| ... } ⇒ Docker::API::Response

Stop a container

Engine API: POST /containers/id/stop

integer or string (e.g. SIGINT). container

Parameters:

  • id (String)

    ID or name of the container

  • signal (String, nil)

    Signal to send to the container as an

  • t (Integer, nil)

    Number of seconds to wait before killing the

  • id: (String)
  • signal: (String, nil)
  • t: (Integer, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



723
724
725
726
727
728
729
730
731
732
# File 'lib/docker/api/operations.rb', line 723

def container_stop(id:, signal: nil, t: nil, &block)
  connection.request(
    :post,
    "/containers/#{Path.escape(id)}/stop",
    query: { "signal" => signal, "t" => t },
    expects: [204],
    operation: "container_stop",
    &block
  )
end

#container_top {|chunk| ... } ⇒ Docker::API::Response

List processes running inside a container

On Unix systems, this is done by running the ps command. This endpoint is not supported on Windows.

Engine API: GET /containers/id/top

aux

Parameters:

  • id (String)

    ID or name of the container

  • ps_args (String, nil)

    The arguments to pass to ps. For example,

  • id: (String)
  • ps_args: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



749
750
751
752
753
754
755
756
757
758
# File 'lib/docker/api/operations.rb', line 749

def container_top(id:, ps_args: nil, &block)
  connection.request(
    :get,
    "/containers/#{Path.escape(id)}/top",
    query: { "ps_args" => ps_args },
    expects: [200],
    operation: "container_top",
    &block
  )
end

#container_unpause {|chunk| ... } ⇒ Docker::API::Response

Unpause a container

Resume a container which has been paused.

Engine API: POST /containers/id/unpause

Parameters:

  • id (String)

    ID or name of the container

  • id: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



772
773
774
775
776
777
778
779
780
# File 'lib/docker/api/operations.rb', line 772

def container_unpause(id:, &block)
  connection.request(
    :post,
    "/containers/#{Path.escape(id)}/unpause",
    expects: [204],
    operation: "container_unpause",
    &block
  )
end

#container_update {|chunk| ... } ⇒ Docker::API::Response

Update a container

Change various configuration options of a container without having to recreate it.

Engine API: POST /containers/id/update

Parameters:

  • id (String)

    ID or name of the container

  • body (Hash)

    (body parameter 'update' in the API specification)

  • id: (String)
  • body: (Hash[String, untyped], String, IO)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



796
797
798
799
800
801
802
803
804
805
# File 'lib/docker/api/operations.rb', line 796

def container_update(id:, body:, &block)
  connection.request(
    :post,
    "/containers/#{Path.escape(id)}/update",
    body: body,
    expects: [200],
    operation: "container_update",
    &block
  )
end

#container_wait {|chunk| ... } ⇒ Docker::API::Response

Wait for a container

Block until a container stops, then returns the exit code.

Engine API: POST /containers/id/wait

given condition.

Parameters:

  • id (String)

    ID or name of the container

  • condition (String, nil)

    Wait until a container state reaches the

  • id: (String)
  • condition: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



822
823
824
825
826
827
828
829
830
831
# File 'lib/docker/api/operations.rb', line 822

def container_wait(id:, condition: nil, &block)
  connection.request(
    :post,
    "/containers/#{Path.escape(id)}/wait",
    query: { "condition" => condition },
    expects: [200],
    operation: "container_wait",
    &block
  )
end

#distribution_inspect {|chunk| ... } ⇒ Docker::API::Response

Get image information from the registry

Return image digest and platform information by contacting the registry.

Engine API: GET /distribution/name/json

image found

Parameters:

  • name (String)

    Image name or id

  • name: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



893
894
895
896
897
898
899
900
901
# File 'lib/docker/api/operations.rb', line 893

def distribution_inspect(name:, &block)
  connection.request(
    :get,
    "/distribution/#{Path.escape(name)}/json",
    expects: [200],
    operation: "distribution_inspect",
    &block
  )
end

#exec_inspect {|chunk| ... } ⇒ Docker::API::Response

Inspect an exec instance

Return low-level information about an exec instance.

Engine API: GET /exec/id/json

Parameters:

  • id (String)

    Exec instance ID

  • id: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



941
942
943
944
945
946
947
948
949
# File 'lib/docker/api/operations.rb', line 941

def exec_inspect(id:, &block)
  connection.request(
    :get,
    "/exec/#{Path.escape(id)}/json",
    expects: [200],
    operation: "exec_inspect",
    &block
  )
end

#exec_resize {|chunk| ... } ⇒ Docker::API::Response

Resize an exec instance

Resize the TTY session used by an exec instance. This endpoint only works if tty was specified as part of creating and starting the exec instance.

Engine API: POST /exec/id/resize

Parameters:

  • id (String)

    Exec instance ID

  • h (Integer)

    Height of the TTY session in characters

  • w (Integer)

    Width of the TTY session in characters

  • id: (String)
  • h: (Integer)
  • w: (Integer)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



967
968
969
970
971
972
973
974
975
976
# File 'lib/docker/api/operations.rb', line 967

def exec_resize(id:, h:, w:, &block)
  connection.request(
    :post,
    "/exec/#{Path.escape(id)}/resize",
    query: { "h" => h, "w" => w },
    expects: [200],
    operation: "exec_resize",
    &block
  )
end

#exec_start {|chunk| ... } ⇒ Docker::API::Response

Start an exec instance

Starts a previously set up exec instance. If detach is true, this endpoint returns immediately after starting the command. Otherwise, it sets up an interactive session with the command.

Engine API: POST /exec/id/start

specification)

Parameters:

  • id (String)

    Exec instance ID

  • body (Hash, nil)

    (body parameter 'execStartConfig' in the API

  • id: (String)
  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



994
995
996
997
998
999
1000
1001
1002
1003
# File 'lib/docker/api/operations.rb', line 994

def exec_start(id:, body: nil, &block)
  connection.request(
    :post,
    "/exec/#{Path.escape(id)}/start",
    body: body,
    expects: [200],
    operation: "exec_start",
    &block
  )
end

#get_plugin_privileges {|chunk| ... } ⇒ Docker::API::Response

Get plugin privileges

Engine API: GET /plugins/privileges

optional, and is the default if omitted.

Parameters:

  • remote (String)

    The name of the plugin. The :latest tag is

  • remote: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
# File 'lib/docker/api/operations.rb', line 1918

def get_plugin_privileges(remote:, &block)
  connection.request(
    :get,
    "/plugins/privileges",
    query: { "remote" => remote },
    expects: [200],
    operation: "get_plugin_privileges",
    &block
  )
end

#image_attestations {|chunk| ... } ⇒ Docker::API::Response

Get attestation statements for an image

Return the in-toto attestation statements attached to the image for the given platform. The daemon locates the attestation manifest(s) that reference the matching platform image manifest, reads their statement layers, and returns the verbatim statement JSON together with layer metadata.

Engine API: GET /images/name/attestations

the image variant whose attestations to return. If omitted, the daemon's default (host) platform is used. returned statements. May be repeated to accept any of several predicate types. If omitted, all statements are returned. body in each returned entry. Defaults to false; when omitted or false, only the descriptor and predicate type are returne... platform value) found for the requested platform not support attestations. This is returned by the legacy (...

Parameters:

  • name (String)

    Image name or id

  • platform (Array<String>, nil)

    JSON-encoded OCI platform to select

  • type (Array<String>, nil)

    In-toto predicate type URI to filter

  • statement (Boolean, nil)

    Include the verbatim in-toto statement

  • name: (String)
  • platform: (Array[untyped], nil)
  • type: (Array[untyped], nil)
  • statement: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
# File 'lib/docker/api/operations.rb', line 1069

def image_attestations(name:, platform: nil, type: nil, statement: nil, &block)
  connection.request(
    :get,
    "/images/#{Path.escape(name)}/attestations",
    query: { "platform" => platform, "type" => type, "statement" => statement },
    expects: [200],
    operation: "image_attestations",
    &block
  )
end

#image_build {|chunk| ... } ⇒ Docker::API::Response

Build an image

Build an image from a tar archive with a Dockerfile in it.

Engine API: POST /build

Dockerfile. This is ignored if remote is specified and points to an external Dockerfile. the name:tag format. If you omit the tag the default latest value is assumed. You can provide several t p... URI. If the URI points to a single text file, the file’s contents are placed into a file called Dockerfile and the... image. resolution. image exists locally. successful build. even upon failure. to disable swap. 0-3, 0,1). microseconds. container can get in a CPU period. variables. Users pass these values at build-time. Docker uses the buildargs as the environment context for commands run... be greater than 0. If omitted the system uses 64MB. single layer. (Experimental release only.) image, as a JSON map of string pairs. commands during build. Supported standard values are: bridge, host, none, and container:<name|id>. Any other value... of a stringified JSON array of objects. Each object must have two top-level properties: Type and Attrs. The `Typ... object with auth configurations for multiple registries that a build may refer to. (sent to the daemon as 'X-Registry-Config') following algorithms: identity (no compression), gzip, bzip2, xz. (body parameter 'inputStream' in the API specification)

Parameters:

  • dockerfile (String, nil)

    Path within the build context to the

  • t (String, nil)

    A name and optional tag to apply to the image in

  • extrahosts (String, nil)

    Extra hosts to add to /etc/hosts

  • remote (String, nil)

    A Git repository URI or HTTP/HTTPS context

  • q (Boolean, nil)

    Suppress verbose build output.

  • nocache (Boolean, nil)

    Do not use the cache when building the

  • cachefrom (String, nil)

    JSON array of images used for build cache

  • pull (String, nil)

    Attempt to pull the image even if an older

  • rm (Boolean, nil)

    Remove intermediate containers after a

  • forcerm (Boolean, nil)

    Always remove intermediate containers,

  • memory (Integer, nil)

    Set memory limit for build.

  • memswap (Integer, nil)

    Total memory (memory + swap). Set as -1

  • cpushares (Integer, nil)

    CPU shares (relative weight).

  • cpusetcpus (String, nil)

    CPUs in which to allow execution (e.g.,

  • cpuperiod (Integer, nil)

    The length of a CPU period in

  • cpuquota (Integer, nil)

    Microseconds of CPU time that the

  • buildargs (String, nil)

    JSON map of string pairs for build-time

  • shmsize (Integer, nil)

    Size of /dev/shm in bytes. The size must

  • squash (Boolean, nil)

    Squash the resulting images layers into a

  • labels (String, nil)

    Arbitrary key/value labels to set on the

  • networkmode (String, nil)

    Sets the networking mode for the run

  • platform (String, nil)

    Platform in the format os[/arch[/variant]]

  • target (String, nil)

    Target build stage

  • outputs (String, nil)

    BuildKit output configuration in the format

  • version (String, nil)

    Version of the builder backend to use.

  • content_type (String, nil)

    (sent to the daemon as 'Content-type')

  • x_registry_config (String, nil)

    This is a base64-encoded JSON

  • body (Hash, nil)

    A tar archive compressed with one of the

  • dockerfile: (String, nil)
  • t: (String, nil)
  • extrahosts: (String, nil)
  • remote: (String, nil)
  • q: (Boolean, nil)
  • nocache: (Boolean, nil)
  • cachefrom: (String, nil)
  • pull: (String, nil)
  • rm: (Boolean, nil)
  • forcerm: (Boolean, nil)
  • memory: (Integer, nil)
  • memswap: (Integer, nil)
  • cpushares: (Integer, nil)
  • cpusetcpus: (String, nil)
  • cpuperiod: (Integer, nil)
  • cpuquota: (Integer, nil)
  • buildargs: (String, nil)
  • shmsize: (Integer, nil)
  • squash: (Boolean, nil)
  • labels: (String, nil)
  • networkmode: (String, nil)
  • platform: (String, nil)
  • target: (String, nil)
  • outputs: (String, nil)
  • version: (String, nil)
  • content_type: (String, nil)
  • x_registry_config: (String, nil)
  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
# File 'lib/docker/api/operations.rb', line 1147

def image_build(
  dockerfile: nil,
  t: nil,
  extrahosts: nil,
  remote: nil,
  q: nil,
  nocache: nil,
  cachefrom: nil,
  pull: nil,
  rm: nil,
  forcerm: nil,
  memory: nil,
  memswap: nil,
  cpushares: nil,
  cpusetcpus: nil,
  cpuperiod: nil,
  cpuquota: nil,
  buildargs: nil,
  shmsize: nil,
  squash: nil,
  labels: nil,
  networkmode: nil,
  platform: nil,
  target: nil,
  outputs: nil,
  version: nil,
  content_type: nil,
  x_registry_config: nil,
  body: nil,
  &block
)
  connection.request(
    :post,
    "/build",
    query: {
      "dockerfile" => dockerfile,
      "t" => t,
      "extrahosts" => extrahosts,
      "remote" => remote,
      "q" => q,
      "nocache" => nocache,
      "cachefrom" => cachefrom,
      "pull" => pull,
      "rm" => rm,
      "forcerm" => forcerm,
      "memory" => memory,
      "memswap" => memswap,
      "cpushares" => cpushares,
      "cpusetcpus" => cpusetcpus,
      "cpuperiod" => cpuperiod,
      "cpuquota" => cpuquota,
      "buildargs" => buildargs,
      "shmsize" => shmsize,
      "squash" => squash,
      "labels" => labels,
      "networkmode" => networkmode,
      "platform" => platform,
      "target" => target,
      "outputs" => outputs,
      "version" => version,
    },
    headers: { "Content-type" => content_type, "X-Registry-Config" => x_registry_config }.compact,
    body: body,
    expects: [200],
    operation: "image_build",
    &block
  )
end

#image_commit {|chunk| ... } ⇒ Docker::API::Response

Create a new image from a container

Engine API: POST /commit

Smith hannibal@a-team.com`) committing committing 'containerConfig' in the API specification)

Parameters:

  • container (String, nil)

    The ID or name of the container to commit

  • repo (String, nil)

    Repository name for the created image

  • tag (String, nil)

    Tag name for the create image

  • comment (String, nil)

    Commit message

  • author (String, nil)

    Author of the image (e.g., `John Hannibal

  • pause (Boolean, nil)

    Whether to pause the container before

  • changes (String, nil)

    Dockerfile instructions to apply while

  • body (Hash, nil)

    The container configuration (body parameter

  • container: (String, nil)
  • repo: (String, nil)
  • tag: (String, nil)
  • comment: (String, nil)
  • author: (String, nil)
  • pause: (Boolean, nil)
  • changes: (String, nil)
  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
# File 'lib/docker/api/operations.rb', line 1237

def image_commit(
  container: nil,
  repo: nil,
  tag: nil,
  comment: nil,
  author: nil,
  pause: nil,
  changes: nil,
  body: nil,
  &block
)
  connection.request(
    :post,
    "/commit",
    query: {
      "container" => container,
      "repo" => repo,
      "tag" => tag,
      "comment" => comment,
      "author" => author,
      "pause" => pause,
      "changes" => changes,
    },
    body: body,
    expects: [201],
    operation: "image_commit",
    &block
  )
end

#image_create {|chunk| ... } ⇒ Docker::API::Response

Create an image

Pull or import an image.

Engine API: POST /images/create

includes a tag or digest, specific behavior applies: (sent to the daemon as 'fromImage') from which the image can be retrieved or - to read the image from the request body. This parameter may only be used w... (sent to the daemon as 'fromSrc') imported. The repo may include a tag. This parameter may only be used when importing an image. this causes all tags for the given image to be pulled. the image that is created, for example: changes=ENV DEBUG=true. Note that ENV DEBUG=true should be URI component encoded. os[/arch[/variant]]. configuration. (sent to the daemon as 'X-Registry-Auth') specified in fromSrc query parameter (body parameter 'inputImage' in the API specification) read access

Parameters:

  • from_image (String, nil)

    Name of the image to pull. If the name

  • from_src (String, nil)

    Source to import. The value may be a URL

  • repo (String, nil)

    Repository name given to an image when it is

  • tag (String, nil)

    Tag or digest. If empty when pulling an image,

  • message (String, nil)

    Set commit message for imported image.

  • changes (Array<String>, nil)

    Apply Dockerfile instructions to

  • platform (String, nil)

    Platform in the format

  • x_registry_auth (String, nil)

    A base64url-encoded auth

  • body (Hash, nil)

    Image content if the value - has been

  • from_image: (String, nil)
  • from_src: (String, nil)
  • repo: (String, nil)
  • tag: (String, nil)
  • message: (String, nil)
  • changes: (Array[untyped], nil)
  • platform: (String, nil)
  • x_registry_auth: (String, nil)
  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
# File 'lib/docker/api/operations.rb', line 1302

def image_create(
  from_image: nil,
  from_src: nil,
  repo: nil,
  tag: nil,
  message: nil,
  changes: nil,
  platform: nil,
  x_registry_auth: nil,
  body: nil,
  &block
)
  connection.request(
    :post,
    "/images/create",
    query: {
      "fromImage" => from_image,
      "fromSrc" => from_src,
      "repo" => repo,
      "tag" => tag,
      "message" => message,
      "changes" => changes,
      "platform" => platform,
    },
    headers: { "X-Registry-Auth" => x_registry_auth }.compact,
    body: body,
    expects: [200],
    operation: "image_create",
    &block
  )
end

#image_delete {|chunk| ... } ⇒ Docker::API::Response

Remove an image

Remove an image, along with any untagged parent images that were referenced by that image.

Engine API: DELETE /images/name

stopped containers or has other tags to delete. Multiple values are accepted. Each platform is a OCI platform encoded as a JSON string.

Parameters:

  • name (String)

    Image name or ID

  • force (Boolean, nil)

    Remove the image even if it is being used by

  • noprune (Boolean, nil)

    Do not delete untagged parent images

  • platforms (Array<String>, nil)

    Select platform-specific content

  • name: (String)
  • force: (Boolean, nil)
  • noprune: (Boolean, nil)
  • platforms: (Array[untyped], nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
# File 'lib/docker/api/operations.rb', line 1354

def image_delete(name:, force: nil, noprune: nil, platforms: nil, &block)
  connection.request(
    :delete,
    "/images/#{Path.escape(name)}",
    query: { "force" => force, "noprune" => noprune, "platforms" => platforms },
    expects: [200],
    operation: "image_delete",
    &block
  )
end

#image_get {|chunk| ... } ⇒ Docker::API::Response

Export an image

Get a tarball containing all images and metadata for a repository.

Engine API: GET /images/name/get

describing a platform which will be used to select a platform-specific image to be saved if the image is multi-platform. If not provid...

Parameters:

  • name (String)

    Image name or ID

  • platform (Array<String>, nil)

    JSON encoded OCI platform

  • name: (String)
  • platform: (Array[untyped], nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
# File 'lib/docker/api/operations.rb', line 1379

def image_get(name:, platform: nil, &block)
  connection.request(
    :get,
    "/images/#{Path.escape(name)}/get",
    query: { "platform" => platform },
    expects: [200],
    operation: "image_get",
    &block
  )
end

#image_get_all {|chunk| ... } ⇒ Docker::API::Response

Export several images

Get a tarball containing all images and metadata for several image repositories.

Engine API: GET /images/get

will be used to select the platform-specific image(s) to be saved if the image is multi-platform. If not provided, the full m...

Parameters:

  • names (Array<String>, nil)

    Image names to filter by

  • platform (Array<String>, nil)

    JSON encoded OCI platform(s) which

  • names: (Array[untyped], nil)
  • platform: (Array[untyped], nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
# File 'lib/docker/api/operations.rb', line 1405

def image_get_all(names: nil, platform: nil, &block)
  connection.request(
    :get,
    "/images/get",
    query: { "names" => names, "platform" => platform },
    expects: [200],
    operation: "image_get_all",
    &block
  )
end

#image_history {|chunk| ... } ⇒ Docker::API::Response

Get the history of an image

Return parent layers of an image.

Engine API: GET /images/name/history

platform-variant. If omitted, it defaults to any locally available platform, prioritizing the daemon's host platform.

Parameters:

  • name (String)

    Image name or ID

  • platform (String, nil)

    JSON-encoded OCI platform to select the

  • name: (String)
  • platform: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
# File 'lib/docker/api/operations.rb', line 1431

def image_history(name:, platform: nil, &block)
  connection.request(
    :get,
    "/images/#{Path.escape(name)}/history",
    query: { "platform" => platform },
    expects: [200],
    operation: "image_history",
    &block
  )
end

#image_inspect {|chunk| ... } ⇒ Docker::API::Response

Inspect an image

Return low-level information about an image.

Engine API: GET /images/name/json

platform-variant. If omitted, it defaults to any locally available platform, prioritizing the daemon's host platform.

Parameters:

  • name (String)

    Image name or id

  • manifests (Boolean, nil)

    Include Manifests in the image summary.

  • platform (String, nil)

    JSON-encoded OCI platform to select the

  • name: (String)
  • manifests: (Boolean, nil)
  • platform: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
# File 'lib/docker/api/operations.rb', line 1458

def image_inspect(name:, manifests: nil, platform: nil, &block)
  connection.request(
    :get,
    "/images/#{Path.escape(name)}/json",
    query: { "manifests" => manifests, "platform" => platform },
    expects: [200],
    operation: "image_inspect",
    &block
  )
end

#image_list {|chunk| ... } ⇒ Docker::API::Response

List Images

Returns a list of images on the server. Note that it uses a different, smaller representation of an image than inspecting a single image.

Engine API: GET /images/json

layer (no children) are shown by default. map[string][]string) to process on the images list. SharedSize field on each image. (sent to the daemon as 'shared-size') field on each image. summary. summary. Requires manifests=1.

Parameters:

  • all (Boolean, nil)

    Show all images. Only images from a final

  • filters (String, nil)

    A JSON encoded value of the filters (a

  • shared_size (Boolean, nil)

    Compute and show shared size as a

  • digests (Boolean, nil)

    Show digest information as a RepoDigests

  • manifests (Boolean, nil)

    Include Manifests in the image

  • identity (Boolean, nil)

    Include Identity in each manifest

  • all: (Boolean, nil)
  • filters: (String, nil)
  • shared_size: (Boolean, nil)
  • digests: (Boolean, nil)
  • manifests: (Boolean, nil)
  • identity: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
# File 'lib/docker/api/operations.rb', line 1492

def image_list(all: nil, filters: nil, shared_size: nil, digests: nil, manifests: nil, identity: nil, &block)
  connection.request(
    :get,
    "/images/json",
    query: {
      "all" => all,
      "filters" => filters,
      "shared-size" => shared_size,
      "digests" => digests,
      "manifests" => manifests,
      "identity" => identity,
    },
    expects: [200],
    operation: "image_list",
    &block
  )
end

#image_load {|chunk| ... } ⇒ Docker::API::Response

Import images

Load a set of images and tags into a repository.

Engine API: POST /images/load

will be used to select the platform-specific image(s) to load if the image is multi-platform. If not provided, the full multi... 'imagesTarball' in the API specification)

Parameters:

  • quiet (Boolean, nil)

    Suppress progress details during load.

  • platform (Array<String>, nil)

    JSON encoded OCI platform(s) which

  • body (Hash, nil)

    Tar archive containing images (body parameter

  • quiet: (Boolean, nil)
  • platform: (Array[untyped], nil)
  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
# File 'lib/docker/api/operations.rb', line 1526

def image_load(quiet: nil, platform: nil, body: nil, &block)
  connection.request(
    :post,
    "/images/load",
    query: { "quiet" => quiet, "platform" => platform },
    body: body,
    expects: [200],
    operation: "image_load",
    &block
  )
end

#image_prune {|chunk| ... } ⇒ Docker::API::Response

Delete unused images

Engine API: POST /images/prune

encoded as JSON (a map[string][]string). Available filters:

Parameters:

  • filters (String, nil)

    Filters to process on the prune list,

  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
# File 'lib/docker/api/operations.rb', line 1548

def image_prune(filters: nil, &block)
  connection.request(
    :post,
    "/images/prune",
    query: { "filters" => filters },
    expects: [200],
    operation: "image_prune",
    &block
  )
end

#image_push {|chunk| ... } ⇒ Docker::API::Response

Push an image

Push an image to a registry.

Engine API: POST /images/name/push

registry.example.com/myimage. The image must be present in the local image store with the same name. (sent to the daemon as 'X-Registry-Auth') latest. If no tag is provided, all tags of the given image that are present in the local image store are pushed. platform-variant to push. If not provided, all available variants will attempt to be pushed.

Parameters:

  • name (String)

    Name of the image to push. For example,

  • x_registry_auth (String)

    A base64url-encoded auth configuration.

  • tag (String, nil)

    Tag of the image to push. For example,

  • platform (String, nil)

    JSON-encoded OCI platform to select the

  • name: (String)
  • x_registry_auth: (String)
  • tag: (String, nil)
  • platform: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
# File 'lib/docker/api/operations.rb', line 1581

def image_push(name:, x_registry_auth:, tag: nil, platform: nil, &block)
  connection.request(
    :post,
    "/images/#{Path.escape(name)}/push",
    query: { "tag" => tag, "platform" => platform },
    headers: { "X-Registry-Auth" => x_registry_auth }.compact,
    expects: [200],
    operation: "image_push",
    &block
  )
end

#image_search {|chunk| ... } ⇒ Docker::API::Response

Search images

Search for an image on Docker Hub.

Engine API: GET /images/search

map[string][]string) to process on the images list. Available filters:

Parameters:

  • term (String)

    Term to search

  • limit (Integer, nil)

    Maximum number of results to return

  • filters (String, nil)

    A JSON encoded value of the filters (a

  • term: (String)
  • limit: (Integer, nil)
  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
# File 'lib/docker/api/operations.rb', line 1607

def image_search(term:, limit: nil, filters: nil, &block)
  connection.request(
    :get,
    "/images/search",
    query: { "term" => term, "limit" => limit, "filters" => filters },
    expects: [200],
    operation: "image_search",
    &block
  )
end

#image_tag {|chunk| ... } ⇒ Docker::API::Response

Tag an image

Create a tag that refers to a source image.

Engine API: POST /images/name/tag

someuser/someimage.

Parameters:

  • name (String)

    Image name or ID to tag.

  • repo (String, nil)

    The repository to tag in. For example,

  • tag (String, nil)

    The name of the new tag.

  • name: (String)
  • repo: (String, nil)
  • tag: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
# File 'lib/docker/api/operations.rb', line 1635

def image_tag(name:, repo: nil, tag: nil, &block)
  connection.request(
    :post,
    "/images/#{Path.escape(name)}/tag",
    query: { "repo" => repo, "tag" => tag },
    expects: [201],
    operation: "image_tag",
    &block
  )
end

#network_connect {|chunk| ... } ⇒ Docker::API::Response

Connect a container to a network

The network must be either a local-scoped network or a swarm-scoped network with the attachable option set. A network cannot be re-attached to a running container

Engine API: POST /networks/id/connect

Parameters:

  • id (String)

    Network ID or name

  • body (Hash)

    (body parameter 'container' in the API specification)

  • id: (String)
  • body: (Hash[String, untyped], String, IO)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
# File 'lib/docker/api/operations.rb', line 1663

def network_connect(id:, body:, &block)
  connection.request(
    :post,
    "/networks/#{Path.escape(id)}/connect",
    body: body,
    expects: [200],
    operation: "network_connect",
    &block
  )
end

#network_create {|chunk| ... } ⇒ Docker::API::Response

Create a network

Engine API: POST /networks/create

in the API specification) when trying to create a network named after a pre-define...

Parameters:

  • body (Hash)

    Network configuration (body parameter 'networkConfig'

  • body: (Hash[String, untyped], String, IO)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
# File 'lib/docker/api/operations.rb', line 1688

def network_create(body:, &block)
  connection.request(
    :post,
    "/networks/create",
    body: body,
    expects: [201],
    operation: "network_create",
    &block
  )
end

#network_delete {|chunk| ... } ⇒ Docker::API::Response

Remove a network

Engine API: DELETE /networks/id

pre-defined networks

Parameters:

  • id (String)

    Network ID or name

  • id: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1711
1712
1713
1714
1715
1716
1717
1718
1719
# File 'lib/docker/api/operations.rb', line 1711

def network_delete(id:, &block)
  connection.request(
    :delete,
    "/networks/#{Path.escape(id)}",
    expects: [204],
    operation: "network_delete",
    &block
  )
end

#network_disconnect {|chunk| ... } ⇒ Docker::API::Response

Disconnect a container from a network

Engine API: POST /networks/id/disconnect

scoped networks

Parameters:

  • id (String)

    Network ID or name

  • body (Hash)

    (body parameter 'container' in the API specification)

  • id: (String)
  • body: (Hash[String, untyped], String, IO)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
# File 'lib/docker/api/operations.rb', line 1734

def network_disconnect(id:, body:, &block)
  connection.request(
    :post,
    "/networks/#{Path.escape(id)}/disconnect",
    body: body,
    expects: [200],
    operation: "network_disconnect",
    &block
  )
end

#network_inspect {|chunk| ... } ⇒ Docker::API::Response

Inspect a network

Engine API: GET /networks/id

troubleshooting or local)

Parameters:

  • id (String)

    Network ID or name

  • verbose (Boolean, nil)

    Detailed inspect output for

  • scope (String, nil)

    Filter the network by scope (swarm, global,

  • id: (String)
  • verbose: (Boolean, nil)
  • scope: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
# File 'lib/docker/api/operations.rb', line 1759

def network_inspect(id:, verbose: nil, scope: nil, &block)
  connection.request(
    :get,
    "/networks/#{Path.escape(id)}",
    query: { "verbose" => verbose, "scope" => scope },
    expects: [200],
    operation: "network_inspect",
    &block
  )
end

#network_list {|chunk| ... } ⇒ Docker::API::Response

List networks

Returns a list of networks. For details on the format, see the network inspect endpoint.

Engine API: GET /networks

map[string][]string) to process on the networks list.

Parameters:

  • filters (String, nil)

    JSON encoded value of the filters (a

  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
# File 'lib/docker/api/operations.rb', line 1783

def network_list(filters: nil, &block)
  connection.request(
    :get,
    "/networks",
    query: { "filters" => filters },
    expects: [200],
    operation: "network_list",
    &block
  )
end

#network_prune {|chunk| ... } ⇒ Docker::API::Response

Delete unused networks

Engine API: POST /networks/prune

encoded as JSON (a map[string][]string).

Parameters:

  • filters (String, nil)

    Filters to process on the prune list,

  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
# File 'lib/docker/api/operations.rb', line 1804

def network_prune(filters: nil, &block)
  connection.request(
    :post,
    "/networks/prune",
    query: { "filters" => filters },
    expects: [200],
    operation: "network_prune",
    &block
  )
end

#node_delete {|chunk| ... } ⇒ Docker::API::Response

Delete a node

Engine API: DELETE /nodes/id

Parameters:

  • id (String)

    The ID or name of the node

  • force (Boolean, nil)

    Force remove a node from the swarm

  • id: (String)
  • force: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
# File 'lib/docker/api/operations.rb', line 1827

def node_delete(id:, force: nil, &block)
  connection.request(
    :delete,
    "/nodes/#{Path.escape(id)}",
    query: { "force" => force },
    expects: [200],
    operation: "node_delete",
    &block
  )
end

#node_inspect {|chunk| ... } ⇒ Docker::API::Response

Inspect a node

Engine API: GET /nodes/id

Parameters:

  • id (String)

    The ID or name of the node

  • id: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1849
1850
1851
1852
1853
1854
1855
1856
1857
# File 'lib/docker/api/operations.rb', line 1849

def node_inspect(id:, &block)
  connection.request(
    :get,
    "/nodes/#{Path.escape(id)}",
    expects: [200],
    operation: "node_inspect",
    &block
  )
end

#node_list {|chunk| ... } ⇒ Docker::API::Response

List nodes

Engine API: GET /nodes

encoded as JSON (a map[string][]string).

Parameters:

  • filters (String, nil)

    Filters to process on the nodes list,

  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
# File 'lib/docker/api/operations.rb', line 1870

def node_list(filters: nil, &block)
  connection.request(
    :get,
    "/nodes",
    query: { "filters" => filters },
    expects: [200],
    operation: "node_list",
    &block
  )
end

#node_update {|chunk| ... } ⇒ Docker::API::Response

Update a node

Engine API: POST /nodes/id/update

updated. This is required to avoid conflicting writes.

Parameters:

  • id (String)

    The ID of the node

  • version (Integer)

    The version number of the node object being

  • body (Hash, nil)

    (body parameter 'body' in the API specification)

  • id: (String)
  • version: (Integer)
  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
# File 'lib/docker/api/operations.rb', line 1896

def node_update(id:, version:, body: nil, &block)
  connection.request(
    :post,
    "/nodes/#{Path.escape(id)}/update",
    query: { "version" => version },
    body: body,
    expects: [200],
    operation: "node_update",
    &block
  )
end

#plugin_create {|chunk| ... } ⇒ Docker::API::Response

Create a plugin

Engine API: POST /plugins/create

optional, and is the default if omitted. manifest (body parameter 'tarContext' in the API specification)

Parameters:

  • name (String)

    The name of the plugin. The :latest tag is

  • body (Hash, nil)

    Path to tar containing plugin rootfs and

  • name: (String)
  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
# File 'lib/docker/api/operations.rb', line 1941

def plugin_create(name:, body: nil, &block)
  connection.request(
    :post,
    "/plugins/create",
    query: { "name" => name },
    body: body,
    expects: [204],
    operation: "plugin_create",
    &block
  )
end

#plugin_delete {|chunk| ... } ⇒ Docker::API::Response

Remove a plugin

Engine API: DELETE /plugins/name

optional, and is the default if omitted. result in issues if the plugin is in use by a container.

Parameters:

  • name (String)

    The name of the plugin. The :latest tag is

  • force (Boolean, nil)

    Disable the plugin before removing. This may

  • name: (String)
  • force: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
# File 'lib/docker/api/operations.rb', line 1966

def plugin_delete(name:, force: nil, &block)
  connection.request(
    :delete,
    "/plugins/#{Path.escape(name)}",
    query: { "force" => force },
    expects: [200],
    operation: "plugin_delete",
    &block
  )
end

#plugin_disable {|chunk| ... } ⇒ Docker::API::Response

Disable a plugin

Engine API: POST /plugins/name/disable

optional, and is the default if omitted.

Parameters:

  • name (String)

    The name of the plugin. The :latest tag is

  • force (Boolean, nil)

    Force disable a plugin even if still in use.

  • name: (String)
  • force: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
# File 'lib/docker/api/operations.rb', line 1989

def plugin_disable(name:, force: nil, &block)
  connection.request(
    :post,
    "/plugins/#{Path.escape(name)}/disable",
    query: { "force" => force },
    expects: [200],
    operation: "plugin_disable",
    &block
  )
end

#plugin_enable {|chunk| ... } ⇒ Docker::API::Response

Enable a plugin

Engine API: POST /plugins/name/enable

optional, and is the default if omitted.

Parameters:

  • name (String)

    The name of the plugin. The :latest tag is

  • timeout (Integer, nil)

    Set the HTTP client timeout (in seconds)

  • name: (String)
  • timeout: (Integer, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
# File 'lib/docker/api/operations.rb', line 2012

def plugin_enable(name:, timeout: nil, &block)
  connection.request(
    :post,
    "/plugins/#{Path.escape(name)}/enable",
    query: { "timeout" => timeout },
    expects: [200],
    operation: "plugin_enable",
    &block
  )
end

#plugin_inspect {|chunk| ... } ⇒ Docker::API::Response

Inspect a plugin

Engine API: GET /plugins/name/json

optional, and is the default if omitted.

Parameters:

  • name (String)

    The name of the plugin. The :latest tag is

  • name: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2034
2035
2036
2037
2038
2039
2040
2041
2042
# File 'lib/docker/api/operations.rb', line 2034

def plugin_inspect(name:, &block)
  connection.request(
    :get,
    "/plugins/#{Path.escape(name)}/json",
    expects: [200],
    operation: "plugin_inspect",
    &block
  )
end

#plugin_list {|chunk| ... } ⇒ Docker::API::Response

List plugins

Returns information about installed plugins.

Engine API: GET /plugins

map[string][]string) to process on the plugin list.

Parameters:

  • filters (String, nil)

    A JSON encoded value of the filters (a

  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
# File 'lib/docker/api/operations.rb', line 2056

def plugin_list(filters: nil, &block)
  connection.request(
    :get,
    "/plugins",
    query: { "filters" => filters },
    expects: [200],
    operation: "plugin_list",
    &block
  )
end

#plugin_pull {|chunk| ... } ⇒ Docker::API::Response

Install a plugin

Pulls and installs a plugin. After the plugin is installed, it can be enabled using the POST /plugins/{name}/enable endpoint.

Engine API: POST /plugins/pull

configuration to use when pulling a plugin from a registry. (sent to the daemon as 'X-Registry-Auth')

Parameters:

  • remote (String)

    Remote reference for plugin to install.

  • name (String, nil)

    Local name for the pulled plugin.

  • x_registry_auth (String, nil)

    A base64url-encoded auth

  • body (Hash, nil)

    (body parameter 'body' in the API specification)

  • remote: (String)
  • name: (String, nil)
  • x_registry_auth: (String, nil)
  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
# File 'lib/docker/api/operations.rb', line 2085

def plugin_pull(remote:, name: nil, x_registry_auth: nil, body: nil, &block)
  connection.request(
    :post,
    "/plugins/pull",
    query: { "remote" => remote, "name" => name },
    headers: { "X-Registry-Auth" => x_registry_auth }.compact,
    body: body,
    expects: [204],
    operation: "plugin_pull",
    &block
  )
end

#plugin_push {|chunk| ... } ⇒ Docker::API::Response

Push a plugin

Push a plugin to the registry.

Engine API: POST /plugins/name/push

optional, and is the default if omitted.

Parameters:

  • name (String)

    The name of the plugin. The :latest tag is

  • name: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2111
2112
2113
2114
2115
2116
2117
2118
2119
# File 'lib/docker/api/operations.rb', line 2111

def plugin_push(name:, &block)
  connection.request(
    :post,
    "/plugins/#{Path.escape(name)}/push",
    expects: [200],
    operation: "plugin_push",
    &block
  )
end

#plugin_set {|chunk| ... } ⇒ Docker::API::Response

Configure a plugin

Engine API: POST /plugins/name/set

optional, and is the default if omitted.

Parameters:

  • name (String)

    The name of the plugin. The :latest tag is

  • body (Hash, nil)

    (body parameter 'body' in the API specification)

  • name: (String)
  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
# File 'lib/docker/api/operations.rb', line 2133

def plugin_set(name:, body: nil, &block)
  connection.request(
    :post,
    "/plugins/#{Path.escape(name)}/set",
    body: body,
    expects: [204],
    operation: "plugin_set",
    &block
  )
end

#plugin_upgrade {|chunk| ... } ⇒ Docker::API::Response

Upgrade a plugin

Engine API: POST /plugins/name/upgrade

optional, and is the default if omitted. configuration to use when pulling a plugin from a registry. (sent to the daemon as 'X-Registry-Auth')

Parameters:

  • name (String)

    The name of the plugin. The :latest tag is

  • remote (String)

    Remote reference to upgrade to.

  • x_registry_auth (String, nil)

    A base64url-encoded auth

  • body (Hash, nil)

    (body parameter 'body' in the API specification)

  • name: (String)
  • remote: (String)
  • x_registry_auth: (String, nil)
  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
# File 'lib/docker/api/operations.rb', line 2160

def plugin_upgrade(name:, remote:, x_registry_auth: nil, body: nil, &block)
  connection.request(
    :post,
    "/plugins/#{Path.escape(name)}/upgrade",
    query: { "remote" => remote },
    headers: { "X-Registry-Auth" => x_registry_auth }.compact,
    body: body,
    expects: [204],
    operation: "plugin_upgrade",
    &block
  )
end

#put_container_archive {|chunk| ... } ⇒ Docker::API::Response

Extract an archive of files or folders to a directory in a container

Upload a tar archive to be extracted to a path in the filesystem of container id. path parameter is asserted to be a directory. If it exists as a file, 400 error will be returned with message "not a directory".

Engine API: PUT /containers/id/archive

archive’s contents into. with one of the following algorithms: identity (no compression), gzip, bzip2, or xz. (body parameter 'inputStream' in the API specification) then it will be an error if unpacking the given content would cause an existing directory to be replaced with a non-directory and vice... (sent to the daemon as 'noOverwriteDirNonDir') UID/GID maps to the dest file or dir (sent to the daemon as 'copyUIDGID') container rootfs is marked as read-only. exist inside the container

Parameters:

  • id (String)

    ID or name of the container

  • path (String)

    Path to a directory in the container to extract the

  • body (Hash)

    The input stream must be a tar archive compressed

  • no_overwrite_dir_non_dir (String, nil)

    If 1, true, or True

  • copy_uidgid (String, nil)

    If 1, true, then it will copy

  • id: (String)
  • path: (String)
  • body: (Hash[String, untyped], String, IO)
  • no_overwrite_dir_non_dir: (String, nil)
  • copy_uidgid: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
# File 'lib/docker/api/operations.rb', line 864

def put_container_archive(id:, path:, body:, no_overwrite_dir_non_dir: nil, copy_uidgid: nil, &block)
  connection.request(
    :put,
    "/containers/#{Path.escape(id)}/archive",
    query: {
      "path" => path,
      "noOverwriteDirNonDir" => no_overwrite_dir_non_dir,
      "copyUIDGID" => copy_uidgid,
    },
    body: body,
    expects: [200],
    operation: "put_container_archive",
    &block
  )
end

#secret_create {|chunk| ... } ⇒ Docker::API::Response

Create a secret

Engine API: POST /secrets/create

object

Parameters:

  • body (Hash, nil)

    (body parameter 'body' in the API specification)

  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
# File 'lib/docker/api/operations.rb', line 2185

def secret_create(body: nil, &block)
  connection.request(
    :post,
    "/secrets/create",
    body: body,
    expects: [201],
    operation: "secret_create",
    &block
  )
end

#secret_delete {|chunk| ... } ⇒ Docker::API::Response

Delete a secret

Engine API: DELETE /secrets/id

Parameters:

  • id (String)

    ID of the secret

  • id: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2207
2208
2209
2210
2211
2212
2213
2214
2215
# File 'lib/docker/api/operations.rb', line 2207

def secret_delete(id:, &block)
  connection.request(
    :delete,
    "/secrets/#{Path.escape(id)}",
    expects: [204],
    operation: "secret_delete",
    &block
  )
end

#secret_inspect {|chunk| ... } ⇒ Docker::API::Response

Inspect a secret

Engine API: GET /secrets/id

Parameters:

  • id (String)

    ID of the secret

  • id: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2228
2229
2230
2231
2232
2233
2234
2235
2236
# File 'lib/docker/api/operations.rb', line 2228

def secret_inspect(id:, &block)
  connection.request(
    :get,
    "/secrets/#{Path.escape(id)}",
    expects: [200],
    operation: "secret_inspect",
    &block
  )
end

#secret_list {|chunk| ... } ⇒ Docker::API::Response

List secrets

Engine API: GET /secrets

map[string][]string) to process on the secrets list.

Parameters:

  • filters (String, nil)

    A JSON encoded value of the filters (a

  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
# File 'lib/docker/api/operations.rb', line 2249

def secret_list(filters: nil, &block)
  connection.request(
    :get,
    "/secrets",
    query: { "filters" => filters },
    expects: [200],
    operation: "secret_list",
    &block
  )
end

#secret_update {|chunk| ... } ⇒ Docker::API::Response

Update a Secret

Engine API: POST /secrets/id/update

updated. This is required to avoid conflicting writes. only the Labels field can be updated. All other fields must remain unchanged from the [SecretInspect endpoint](#ope... (body parameter 'body' in the API specification)

Parameters:

  • id (String)

    The ID or name of the secret

  • version (Integer)

    The version number of the secret object being

  • body (Hash, nil)

    The spec of the secret to update. Currently,

  • id: (String)
  • version: (Integer)
  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
# File 'lib/docker/api/operations.rb', line 2278

def secret_update(id:, version:, body: nil, &block)
  connection.request(
    :post,
    "/secrets/#{Path.escape(id)}/update",
    query: { "version" => version },
    body: body,
    expects: [200],
    operation: "secret_update",
    &block
  )
end

#service_create {|chunk| ... } ⇒ Docker::API::Response

Create a service

Engine API: POST /services/create

configuration for pulling from private registries. (sent to the daemon as 'X-Registry-Auth') services service

Parameters:

  • body (Hash)

    (body parameter 'body' in the API specification)

  • x_registry_auth (String, nil)

    A base64url-encoded auth

  • body: (Hash[String, untyped], String, IO)
  • x_registry_auth: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
# File 'lib/docker/api/operations.rb', line 2308

def service_create(body:, x_registry_auth: nil, &block)
  connection.request(
    :post,
    "/services/create",
    headers: { "X-Registry-Auth" => x_registry_auth }.compact,
    body: body,
    expects: [201],
    operation: "service_create",
    &block
  )
end

#service_delete {|chunk| ... } ⇒ Docker::API::Response

Delete a service

Engine API: DELETE /services/id

Parameters:

  • id (String)

    ID or name of service.

  • id: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2331
2332
2333
2334
2335
2336
2337
2338
2339
# File 'lib/docker/api/operations.rb', line 2331

def service_delete(id:, &block)
  connection.request(
    :delete,
    "/services/#{Path.escape(id)}",
    expects: [200],
    operation: "service_delete",
    &block
  )
end

#service_inspect {|chunk| ... } ⇒ Docker::API::Response

Inspect a service

Engine API: GET /services/id

values. (sent to the daemon as 'insertDefaults')

Parameters:

  • id (String)

    ID or name of service.

  • insert_defaults (Boolean, nil)

    Fill empty fields with default

  • id: (String)
  • insert_defaults: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
# File 'lib/docker/api/operations.rb', line 2354

def service_inspect(id:, insert_defaults: nil, &block)
  connection.request(
    :get,
    "/services/#{Path.escape(id)}",
    query: { "insertDefaults" => insert_defaults },
    expects: [200],
    operation: "service_inspect",
    &block
  )
end

#service_list {|chunk| ... } ⇒ Docker::API::Response

List services

Engine API: GET /services

map[string][]string) to process on the services list. running and desired tasks.

Parameters:

  • filters (String, nil)

    A JSON encoded value of the filters (a

  • status (Boolean, nil)

    Include service status, with count of

  • filters: (String, nil)
  • status: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
# File 'lib/docker/api/operations.rb', line 2378

def service_list(filters: nil, status: nil, &block)
  connection.request(
    :get,
    "/services",
    query: { "filters" => filters, "status" => status },
    expects: [200],
    operation: "service_list",
    &block
  )
end

#service_logs {|chunk| ... } ⇒ Docker::API::Response

Get service logs

Get stdout and stderr logs from a service. See also /containers/{id}/logs.

Engine API: GET /services/id/logs

provided to logs. timestamp end of the logs. Specify as an integer or all to output all log lines.

Parameters:

  • id (String)

    ID or name of the service

  • details (Boolean, nil)

    Show service context and extra details

  • follow (Boolean, nil)

    Keep connection after returning logs.

  • stdout (Boolean, nil)

    Return logs from stdout

  • stderr (Boolean, nil)

    Return logs from stderr

  • since (Integer, nil)

    Only return logs since this time, as a UNIX

  • timestamps (Boolean, nil)

    Add timestamps to every log line

  • tail (String, nil)

    Only return this number of log lines from the

  • id: (String)
  • details: (Boolean, nil)
  • follow: (Boolean, nil)
  • stdout: (Boolean, nil)
  • stderr: (Boolean, nil)
  • since: (Integer, nil)
  • timestamps: (Boolean, nil)
  • tail: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
# File 'lib/docker/api/operations.rb', line 2413

def service_logs(
  id:,
  details: nil,
  follow: nil,
  stdout: nil,
  stderr: nil,
  since: nil,
  timestamps: nil,
  tail: nil,
  &block
)
  connection.request(
    :get,
    "/services/#{Path.escape(id)}/logs",
    query: {
      "details" => details,
      "follow" => follow,
      "stdout" => stdout,
      "stderr" => stderr,
      "since" => since,
      "timestamps" => timestamps,
      "tail" => tail,
    },
    expects: [200],
    operation: "service_logs",
    &block
  )
end

#service_update {|chunk| ... } ⇒ Docker::API::Response

Update a service

Engine API: POST /services/id/update

updated. This is required to avoid conflicting writes. This version number should be the value as currently set o... is not specified, this parameter indicates where to find registry authorization credentials. (sent to the daemon as 'registryAuthFrom') cause a server-side rollback to the previous service spec. The supplied spec will be ignored in this case. configuration for pulling from private registries. (sent to the daemon as 'X-Registry-Auth')

Parameters:

  • id (String)

    ID or name of service.

  • body (Hash)

    (body parameter 'body' in the API specification)

  • version (Integer)

    The version number of the service object being

  • registry_auth_from (String, nil)

    If the X-Registry-Auth header

  • rollback (String, nil)

    Set to this parameter to previous to

  • x_registry_auth (String, nil)

    A base64url-encoded auth

  • id: (String)
  • body: (Hash[String, untyped], String, IO)
  • version: (Integer)
  • registry_auth_from: (String, nil)
  • rollback: (String, nil)
  • x_registry_auth: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
# File 'lib/docker/api/operations.rb', line 2467

def service_update(id:, body:, version:, registry_auth_from: nil, rollback: nil, x_registry_auth: nil, &block)
  connection.request(
    :post,
    "/services/#{Path.escape(id)}/update",
    query: { "version" => version, "registryAuthFrom" => registry_auth_from, "rollback" => rollback },
    headers: { "X-Registry-Auth" => x_registry_auth }.compact,
    body: body,
    expects: [200],
    operation: "service_update",
    &block
  )
end

#session {|chunk| ... } ⇒ Docker::API::Response

Initialize interactive session

Start a new interactive session with a server. Session allows server to call back to the client for advanced capabilities.

Engine API: POST /session

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2493
2494
2495
2496
2497
2498
2499
2500
2501
# File 'lib/docker/api/operations.rb', line 2493

def session(&block)
  connection.request(
    :post,
    "/session",
    expects: [200],
    operation: "session",
    &block
  )
end

#swarm_init {|chunk| ... } ⇒ Docker::API::Response

Initialize a new swarm

Engine API: POST /swarm/init

Parameters:

  • body (Hash)

    (body parameter 'body' in the API specification)

  • body: (Hash[String, untyped], String, IO)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
# File 'lib/docker/api/operations.rb', line 2514

def swarm_init(body:, &block)
  connection.request(
    :post,
    "/swarm/init",
    body: body,
    expects: [200],
    operation: "swarm_init",
    &block
  )
end

#swarm_inspect {|chunk| ... } ⇒ Docker::API::Response

Inspect swarm

Engine API: GET /swarm

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2535
2536
2537
2538
2539
2540
2541
2542
2543
# File 'lib/docker/api/operations.rb', line 2535

def swarm_inspect(&block)
  connection.request(
    :get,
    "/swarm",
    expects: [200],
    operation: "swarm_inspect",
    &block
  )
end

#swarm_join {|chunk| ... } ⇒ Docker::API::Response

Join an existing swarm

Engine API: POST /swarm/join

Parameters:

  • body (Hash)

    (body parameter 'body' in the API specification)

  • body: (Hash[String, untyped], String, IO)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
# File 'lib/docker/api/operations.rb', line 2556

def swarm_join(body:, &block)
  connection.request(
    :post,
    "/swarm/join",
    body: body,
    expects: [200],
    operation: "swarm_join",
    &block
  )
end

#swarm_leave {|chunk| ... } ⇒ Docker::API::Response

Leave a swarm

Engine API: POST /swarm/leave

manager or that it will break the cluster.

Parameters:

  • force (Boolean, nil)

    Force leave swarm, even if this is the last

  • force: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
# File 'lib/docker/api/operations.rb', line 2578

def swarm_leave(force: nil, &block)
  connection.request(
    :post,
    "/swarm/leave",
    query: { "force" => force },
    expects: [200],
    operation: "swarm_leave",
    &block
  )
end

#swarm_unlock {|chunk| ... } ⇒ Docker::API::Response

Unlock a locked manager

Engine API: POST /swarm/unlock

Parameters:

  • body (Hash)

    (body parameter 'body' in the API specification)

  • body: (Hash[String, untyped], String, IO)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
# File 'lib/docker/api/operations.rb', line 2599

def swarm_unlock(body:, &block)
  connection.request(
    :post,
    "/swarm/unlock",
    body: body,
    expects: [200],
    operation: "swarm_unlock",
    &block
  )
end

#swarm_unlockkey {|chunk| ... } ⇒ Docker::API::Response

Get the unlock key

Engine API: GET /swarm/unlockkey

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2619
2620
2621
2622
2623
2624
2625
2626
2627
# File 'lib/docker/api/operations.rb', line 2619

def swarm_unlockkey(&block)
  connection.request(
    :get,
    "/swarm/unlockkey",
    expects: [200],
    operation: "swarm_unlockkey",
    &block
  )
end

#swarm_update {|chunk| ... } ⇒ Docker::API::Response

Update a swarm

Engine API: POST /swarm/update

updated. This is required to avoid conflicting writes. (sent to the daemon as 'rotateWorkerToken') token. (sent to the daemon as 'rotateManagerToken') unlock key. (sent to the daemon as 'rotateManagerUnlockKey')

Parameters:

  • body (Hash)

    (body parameter 'body' in the API specification)

  • version (Integer)

    The version number of the swarm object being

  • rotate_worker_token (Boolean, nil)

    Rotate the worker join token.

  • rotate_manager_token (Boolean, nil)

    Rotate the manager join

  • rotate_manager_unlock_key (Boolean, nil)

    Rotate the manager

  • body: (Hash[String, untyped], String, IO)
  • version: (Integer)
  • rotate_worker_token: (Boolean, nil)
  • rotate_manager_token: (Boolean, nil)
  • rotate_manager_unlock_key: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
# File 'lib/docker/api/operations.rb', line 2648

def swarm_update(
  body:,
  version:,
  rotate_worker_token: nil,
  rotate_manager_token: nil,
  rotate_manager_unlock_key: nil,
  &block
)
  connection.request(
    :post,
    "/swarm/update",
    query: {
      "version" => version,
      "rotateWorkerToken" => rotate_worker_token,
      "rotateManagerToken" => rotate_manager_token,
      "rotateManagerUnlockKey" => rotate_manager_unlock_key,
    },
    body: body,
    expects: [200],
    operation: "swarm_update",
    &block
  )
end

#system_auth {|chunk| ... } ⇒ Docker::API::Response

Check auth configuration

Validate credentials for a registry and, if available, get an identity token for accessing the registry without password.

Engine API: POST /auth

'authConfig' in the API specification)

Parameters:

  • body (Hash, nil)

    Authentication to check (body parameter

  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
# File 'lib/docker/api/operations.rb', line 2686

def system_auth(body: nil, &block)
  connection.request(
    :post,
    "/auth",
    body: body,
    expects: [200, 204],
    operation: "system_auth",
    &block
  )
end

#system_data_usage {|chunk| ... } ⇒ Docker::API::Response

Get data usage information

Engine API: GET /system/df

return data.

Parameters:

  • type (Array<String>, nil)

    Object types, for which to compute and

  • verbose (Boolean, nil)

    Show detailed information on space usage.

  • type: (Array[untyped], nil)
  • verbose: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
# File 'lib/docker/api/operations.rb', line 2708

def system_data_usage(type: nil, verbose: nil, &block)
  connection.request(
    :get,
    "/system/df",
    query: { "type" => type, "verbose" => verbose },
    expects: [200],
    operation: "system_data_usage",
    &block
  )
end

#system_events {|chunk| ... } ⇒ Docker::API::Response

Monitor events

Stream real-time events from the server.

Engine API: GET /events

stream new events. then stop streaming. (sent to the daemon as 'until') map[string][]string) to process on the event list. Available filters:

Parameters:

  • since (String, nil)

    Show events created since this timestamp then

  • until_ (String, nil)

    Show events created until this timestamp

  • filters (String, nil)

    A JSON encoded value of filters (a

  • since: (String, nil)
  • until_: (String, nil)
  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
# File 'lib/docker/api/operations.rb', line 2736

def system_events(since: nil, until_: nil, filters: nil, &block)
  connection.request(
    :get,
    "/events",
    query: { "since" => since, "until" => until_, "filters" => filters },
    expects: [200],
    operation: "system_events",
    &block
  )
end

#system_info {|chunk| ... } ⇒ Docker::API::Response

Get system information

Engine API: GET /info

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2755
2756
2757
2758
2759
2760
2761
2762
2763
# File 'lib/docker/api/operations.rb', line 2755

def system_info(&block)
  connection.request(
    :get,
    "/info",
    expects: [200],
    operation: "system_info",
    &block
  )
end

#system_ping {|chunk| ... } ⇒ Docker::API::Response

Ping

This is a dummy endpoint you can use to test if the server is accessible.

Engine API: GET /_ping

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2775
2776
2777
2778
2779
2780
2781
2782
2783
# File 'lib/docker/api/operations.rb', line 2775

def system_ping(&block)
  connection.request(
    :get,
    "/_ping",
    expects: [200],
    operation: "system_ping",
    &block
  )
end

#system_ping_head {|chunk| ... } ⇒ Docker::API::Response

Ping

This is a dummy endpoint you can use to test if the server is accessible.

Engine API: HEAD /_ping

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2795
2796
2797
2798
2799
2800
2801
2802
2803
# File 'lib/docker/api/operations.rb', line 2795

def system_ping_head(&block)
  connection.request(
    :head,
    "/_ping",
    expects: [200],
    operation: "system_ping_head",
    &block
  )
end

#system_version {|chunk| ... } ⇒ Docker::API::Response

Get version

Returns the version of Docker that is running and various information about the system that Docker is running on.

Engine API: GET /version

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2816
2817
2818
2819
2820
2821
2822
2823
2824
# File 'lib/docker/api/operations.rb', line 2816

def system_version(&block)
  connection.request(
    :get,
    "/version",
    expects: [200],
    operation: "system_version",
    &block
  )
end

#task_inspect {|chunk| ... } ⇒ Docker::API::Response

Inspect a task

Engine API: GET /tasks/id

Parameters:

  • id (String)

    ID of the task

  • id: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2837
2838
2839
2840
2841
2842
2843
2844
2845
# File 'lib/docker/api/operations.rb', line 2837

def task_inspect(id:, &block)
  connection.request(
    :get,
    "/tasks/#{Path.escape(id)}",
    expects: [200],
    operation: "task_inspect",
    &block
  )
end

#task_list {|chunk| ... } ⇒ Docker::API::Response

List tasks

Engine API: GET /tasks

map[string][]string) to process on the tasks list.

Parameters:

  • filters (String, nil)

    A JSON encoded value of the filters (a

  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
# File 'lib/docker/api/operations.rb', line 2858

def task_list(filters: nil, &block)
  connection.request(
    :get,
    "/tasks",
    query: { "filters" => filters },
    expects: [200],
    operation: "task_list",
    &block
  )
end

#task_logs {|chunk| ... } ⇒ Docker::API::Response

Get task logs

Get stdout and stderr logs from a task. See also /containers/{id}/logs.

Engine API: GET /tasks/id/logs

provided to logs. timestamp end of the logs. Specify as an integer or all to output all log lines.

Parameters:

  • id (String)

    ID of the task

  • details (Boolean, nil)

    Show task context and extra details

  • follow (Boolean, nil)

    Keep connection after returning logs.

  • stdout (Boolean, nil)

    Return logs from stdout

  • stderr (Boolean, nil)

    Return logs from stderr

  • since (Integer, nil)

    Only return logs since this time, as a UNIX

  • timestamps (Boolean, nil)

    Add timestamps to every log line

  • tail (String, nil)

    Only return this number of log lines from the

  • id: (String)
  • details: (Boolean, nil)
  • follow: (Boolean, nil)
  • stdout: (Boolean, nil)
  • stderr: (Boolean, nil)
  • since: (Integer, nil)
  • timestamps: (Boolean, nil)
  • tail: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
# File 'lib/docker/api/operations.rb', line 2893

def task_logs(
  id:,
  details: nil,
  follow: nil,
  stdout: nil,
  stderr: nil,
  since: nil,
  timestamps: nil,
  tail: nil,
  &block
)
  connection.request(
    :get,
    "/tasks/#{Path.escape(id)}/logs",
    query: {
      "details" => details,
      "follow" => follow,
      "stdout" => stdout,
      "stderr" => stderr,
      "since" => since,
      "timestamps" => timestamps,
      "tail" => tail,
    },
    expects: [200],
    operation: "task_logs",
    &block
  )
end

#volume_create {|chunk| ... } ⇒ Docker::API::Response

Create a volume

Engine API: POST /volumes/create

in the API specification)

Parameters:

  • body (Hash)

    Volume configuration (body parameter 'volumeConfig'

  • body: (Hash[String, untyped], String, IO)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
# File 'lib/docker/api/operations.rb', line 2932

def volume_create(body:, &block)
  connection.request(
    :post,
    "/volumes/create",
    body: body,
    expects: [201],
    operation: "volume_create",
    &block
  )
end

#volume_delete {|chunk| ... } ⇒ Docker::API::Response

Remove a volume

Instruct the driver to remove the volume.

Engine API: DELETE /volumes/name

removed

Parameters:

  • name (String)

    Volume name or ID

  • force (Boolean, nil)

    Force the removal of the volume

  • name: (String)
  • force: (Boolean, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
# File 'lib/docker/api/operations.rb', line 2958

def volume_delete(name:, force: nil, &block)
  connection.request(
    :delete,
    "/volumes/#{Path.escape(name)}",
    query: { "force" => force },
    expects: [204],
    operation: "volume_delete",
    &block
  )
end

#volume_inspect {|chunk| ... } ⇒ Docker::API::Response

Inspect a volume

Engine API: GET /volumes/name

Parameters:

  • name (String)

    Volume name or ID

  • name: (String)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



2979
2980
2981
2982
2983
2984
2985
2986
2987
# File 'lib/docker/api/operations.rb', line 2979

def volume_inspect(name:, &block)
  connection.request(
    :get,
    "/volumes/#{Path.escape(name)}",
    expects: [200],
    operation: "volume_inspect",
    &block
  )
end

#volume_list {|chunk| ... } ⇒ Docker::API::Response

List volumes

Engine API: GET /volumes

map[string][]string) to process on the volumes list. Available filters:

Parameters:

  • filters (String, nil)

    JSON encoded value of the filters (a

  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
# File 'lib/docker/api/operations.rb', line 3000

def volume_list(filters: nil, &block)
  connection.request(
    :get,
    "/volumes",
    query: { "filters" => filters },
    expects: [200],
    operation: "volume_list",
    &block
  )
end

#volume_prune {|chunk| ... } ⇒ Docker::API::Response

Delete unused volumes

Engine API: POST /volumes/prune

encoded as JSON (a map[string][]string).

Parameters:

  • filters (String, nil)

    Filters to process on the prune list,

  • filters: (String, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
# File 'lib/docker/api/operations.rb', line 3021

def volume_prune(filters: nil, &block)
  connection.request(
    :post,
    "/volumes/prune",
    query: { "filters" => filters },
    expects: [200],
    operation: "volume_prune",
    &block
  )
end

#volume_update {|chunk| ... } ⇒ Docker::API::Response

"Update a volume. Valid only for Swarm cluster volumes"

Engine API: PUT /volumes/name

This is required to avoid conflicting writes. Found in the volume's ClusterVolume field. only Availability may change. All other fields must remain unchanged. (body parameter 'body' in the API specification)

Parameters:

  • name (String)

    The name or ID of the volume

  • version (Integer)

    The version number of the volume being updated.

  • body (Hash, nil)

    The spec of the volume to update. Currently,

  • name: (String)
  • version: (Integer)
  • body: (Hash[String, untyped], String, IO, nil)

Yield Parameters:

  • chunk (String)

    successive body chunks, when a block is given

Returns:

Raises:



3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
# File 'lib/docker/api/operations.rb', line 3050

def volume_update(name:, version:, body: nil, &block)
  connection.request(
    :put,
    "/volumes/#{Path.escape(name)}",
    query: { "version" => version },
    body: body,
    expects: [200],
    operation: "volume_update",
    &block
  )
end