Class: DockerEngineRuby::Resources::Images
- Inherits:
-
Object
- Object
- DockerEngineRuby::Resources::Images
- Defined in:
- lib/docker_engine_ruby/resources/images.rb
Instance Method Summary collapse
-
#build(body:, buildargs: nil, cachefrom: nil, cpuperiod: nil, cpuquota: nil, cpusetcpus: nil, cpushares: nil, dockerfile: nil, extrahosts: nil, forcerm: nil, labels: nil, memory: nil, memswap: nil, networkmode: nil, nocache: nil, outputs: nil, platform: nil, pull: nil, q: nil, remote: nil, rm: nil, shmsize: nil, squash: nil, t: nil, target: nil, version: nil, x_registry_config: nil, request_options: {}) ⇒ nil
Build an image.
-
#build_prune(all: nil, filters: nil, max_used_space: nil, min_free_space: nil, reserved_space: nil, request_options: {}) ⇒ DockerEngineRuby::Models::ImageBuildPruneResponse
Delete builder cache.
-
#commit(author: nil, changes: nil, comment: nil, container: nil, pause: nil, repo: nil, tag: nil, args_escaped: nil, attach_stderr: nil, attach_stdin: nil, attach_stdout: nil, cmd: nil, domainname: nil, entrypoint: nil, env: nil, exposed_ports: nil, healthcheck: nil, hostname: nil, image: nil, labels: nil, network_disabled: nil, on_build: nil, open_stdin: nil, shell: nil, stdin_once: nil, stop_signal: nil, stop_timeout: nil, tty: nil, user: nil, volumes: nil, working_dir: nil, request_options: {}) ⇒ DockerEngineRuby::Models::ImageCommitResponse
Some parameter documentations has been truncated, see Models::ImageCommitParams for more details.
-
#delete(name, force: nil, noprune: nil, platforms: nil, request_options: {}) ⇒ Array<DockerEngineRuby::Models::DeleteItem>
Remove an image.
-
#get(name, platform: nil, request_options: {}) ⇒ StringIO
Export an image.
-
#get_all(names: nil, platform: nil, request_options: {}) ⇒ StringIO
Export several images.
-
#history(name, platform: nil, request_options: {}) ⇒ Array<DockerEngineRuby::Models::HistoryItem>
Get the history of an image.
-
#initialize(client:) ⇒ Images
constructor
private
A new instance of Images.
-
#inspect_(name, manifests: nil, request_options: {}) ⇒ DockerEngineRuby::Models::Image
Inspect an image.
-
#list(all: nil, digests: nil, filters: nil, manifests: nil, shared_size: nil, request_options: {}) ⇒ Array<DockerEngineRuby::Models::ImageSummary>
List Images.
-
#load_(body:, platform: nil, quiet: nil, request_options: {}) ⇒ nil
Import images.
-
#prune(filters: nil, request_options: {}) ⇒ DockerEngineRuby::Models::ImagePruneResponse
Delete unused images.
-
#pull(body:, changes: nil, from_image: nil, from_src: nil, message: nil, platform: nil, repo: nil, tag: nil, x_registry_auth: nil, request_options: {}) ⇒ nil
Create an image.
-
#push(name, x_registry_auth:, platform: nil, tag: nil, request_options: {}) ⇒ nil
Push an image.
-
#search(term:, filters: nil, limit: nil, request_options: {}) ⇒ Array<DockerEngineRuby::Models::ImageSearchResponseItem>
Search images.
-
#tag(name, repo: nil, tag: nil, request_options: {}) ⇒ nil
Tag an image.
Constructor Details
#initialize(client:) ⇒ Images
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Images.
541 542 543 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 541 def initialize(client:) @client = client end |
Instance Method Details
#build(body:, buildargs: nil, cachefrom: nil, cpuperiod: nil, cpuquota: nil, cpusetcpus: nil, cpushares: nil, dockerfile: nil, extrahosts: nil, forcerm: nil, labels: nil, memory: nil, memswap: nil, networkmode: nil, nocache: nil, outputs: nil, platform: nil, pull: nil, q: nil, remote: nil, rm: nil, shmsize: nil, squash: nil, t: nil, target: nil, version: nil, x_registry_config: nil, request_options: {}) ⇒ nil
Build an image
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 118 def build(params) parsed, = DockerEngineRuby::ImageBuildParams.dump_request(params) query_params = [ :buildargs, :cachefrom, :cpuperiod, :cpuquota, :cpusetcpus, :cpushares, :dockerfile, :extrahosts, :forcerm, :labels, :memory, :memswap, :networkmode, :nocache, :outputs, :platform, :pull, :q, :remote, :rm, :shmsize, :squash, :t, :target, :version ] @client.request( method: :post, path: "build", query: parsed.slice(*query_params), headers: { "content-type" => "application/x-tar", **parsed.except(:body, *query_params) }.transform_keys( x_registry_config: "x-registry-config" ), body: parsed[:body], model: NilClass, options: ) end |
#build_prune(all: nil, filters: nil, max_used_space: nil, min_free_space: nil, reserved_space: nil, request_options: {}) ⇒ DockerEngineRuby::Models::ImageBuildPruneResponse
Delete builder cache
178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 178 def build_prune(params = {}) parsed, = DockerEngineRuby::ImageBuildPruneParams.dump_request(params) @client.request( method: :post, path: "build/prune", query: parsed.transform_keys( max_used_space: "max-used-space", min_free_space: "min-free-space", reserved_space: "reserved-space" ), model: DockerEngineRuby::Models::ImageBuildPruneResponse, options: ) end |
#commit(author: nil, changes: nil, comment: nil, container: nil, pause: nil, repo: nil, tag: nil, args_escaped: nil, attach_stderr: nil, attach_stdin: nil, attach_stdout: nil, cmd: nil, domainname: nil, entrypoint: nil, env: nil, exposed_ports: nil, healthcheck: nil, hostname: nil, image: nil, labels: nil, network_disabled: nil, on_build: nil, open_stdin: nil, shell: nil, stdin_once: nil, stop_signal: nil, stop_timeout: nil, tty: nil, user: nil, volumes: nil, working_dir: nil, request_options: {}) ⇒ DockerEngineRuby::Models::ImageCommitResponse
Some parameter documentations has been truncated, see Models::ImageCommitParams for more details.
Create a new image from a container
267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 267 def commit(params = {}) parsed, = DockerEngineRuby::ImageCommitParams.dump_request(params) query_params = [:author, :changes, :comment, :container, :pause, :repo, :tag] @client.request( method: :post, path: "commit", query: parsed.slice(*query_params), body: parsed.except(*query_params), model: DockerEngineRuby::Models::ImageCommitResponse, options: ) end |
#delete(name, force: nil, noprune: nil, platforms: nil, request_options: {}) ⇒ Array<DockerEngineRuby::Models::DeleteItem>
Remove an image
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 44 def delete(name, params = {}) parsed, = DockerEngineRuby::ImageDeleteParams.dump_request(params) @client.request( method: :delete, path: ["images/%1$s", name], query: parsed, model: DockerEngineRuby::Internal::Type::ArrayOf[DockerEngineRuby::DeleteItem], options: ) end |
#get(name, platform: nil, request_options: {}) ⇒ StringIO
Export an image
291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 291 def get(name, params = {}) parsed, = DockerEngineRuby::ImageGetParams.dump_request(params) @client.request( method: :get, path: ["images/%1$s/get", name], query: parsed, headers: {"accept" => "application/octet-stream"}, model: StringIO, options: ) end |
#get_all(names: nil, platform: nil, request_options: {}) ⇒ StringIO
Export several images
314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 314 def get_all(params = {}) parsed, = DockerEngineRuby::ImageGetAllParams.dump_request(params) @client.request( method: :get, path: "images/get", query: parsed, headers: {"accept" => "application/octet-stream"}, model: StringIO, options: ) end |
#history(name, platform: nil, request_options: {}) ⇒ Array<DockerEngineRuby::Models::HistoryItem>
Get the history of an image
337 338 339 340 341 342 343 344 345 346 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 337 def history(name, params = {}) parsed, = DockerEngineRuby::ImageHistoryParams.dump_request(params) @client.request( method: :get, path: ["images/%1$s/history", name], query: parsed, model: DockerEngineRuby::Internal::Type::ArrayOf[DockerEngineRuby::HistoryItem], options: ) end |
#inspect_(name, manifests: nil, request_options: {}) ⇒ DockerEngineRuby::Models::Image
Inspect an image
359 360 361 362 363 364 365 366 367 368 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 359 def inspect_(name, params = {}) parsed, = DockerEngineRuby::ImageInspectParams.dump_request(params) @client.request( method: :get, path: ["images/%1$s/json", name], query: parsed, model: DockerEngineRuby::Image, options: ) end |
#list(all: nil, digests: nil, filters: nil, manifests: nil, shared_size: nil, request_options: {}) ⇒ Array<DockerEngineRuby::Models::ImageSummary>
List Images
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 20 def list(params = {}) parsed, = DockerEngineRuby::ImageListParams.dump_request(params) @client.request( method: :get, path: "images/json", query: parsed.transform_keys(shared_size: "shared-size"), model: DockerEngineRuby::Internal::Type::ArrayOf[DockerEngineRuby::ImageSummary], options: ) end |
#load_(body:, platform: nil, quiet: nil, request_options: {}) ⇒ nil
Import images
385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 385 def load_(params) parsed, = DockerEngineRuby::ImageLoadParams.dump_request(params) @client.request( method: :post, path: "images/load", query: parsed.except(:body), headers: {"content-type" => "application/octet-stream"}, body: parsed[:body], model: NilClass, options: ) end |
#prune(filters: nil, request_options: {}) ⇒ DockerEngineRuby::Models::ImagePruneResponse
Delete unused images
408 409 410 411 412 413 414 415 416 417 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 408 def prune(params = {}) parsed, = DockerEngineRuby::ImagePruneParams.dump_request(params) @client.request( method: :post, path: "images/prune", query: parsed, model: DockerEngineRuby::Models::ImagePruneResponse, options: ) end |
#pull(body:, changes: nil, from_image: nil, from_src: nil, message: nil, platform: nil, repo: nil, tag: nil, x_registry_auth: nil, request_options: {}) ⇒ nil
Create an image
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 446 def pull(params) parsed, = DockerEngineRuby::ImagePullParams.dump_request(params) query_params = [:changes, :from_image, :from_src, :message, :platform, :repo, :tag] @client.request( method: :post, path: "images/create", query: parsed.slice(*query_params).transform_keys(from_image: "fromImage", from_src: "fromSrc"), headers: {"content-type" => "text/plain", **parsed.except(:body, *query_params)}.transform_keys( x_registry_auth: "x-registry-auth" ), body: parsed[:body], model: NilClass, options: ) end |
#push(name, x_registry_auth:, platform: nil, tag: nil, request_options: {}) ⇒ nil
Push an image
479 480 481 482 483 484 485 486 487 488 489 490 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 479 def push(name, params) parsed, = DockerEngineRuby::ImagePushParams.dump_request(params) query_params = [:platform, :tag] @client.request( method: :post, path: ["images/%1$s/push", name], query: parsed.slice(*query_params), headers: parsed.except(*query_params).transform_keys(x_registry_auth: "x-registry-auth"), model: NilClass, options: ) end |
#search(term:, filters: nil, limit: nil, request_options: {}) ⇒ Array<DockerEngineRuby::Models::ImageSearchResponseItem>
Search images
504 505 506 507 508 509 510 511 512 513 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 504 def search(params) parsed, = DockerEngineRuby::ImageSearchParams.dump_request(params) @client.request( method: :get, path: "images/search", query: parsed, model: DockerEngineRuby::Internal::Type::ArrayOf[DockerEngineRuby::Models::ImageSearchResponseItem], options: ) end |
#tag(name, repo: nil, tag: nil, request_options: {}) ⇒ nil
Tag an image
527 528 529 530 531 532 533 534 535 536 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 527 def tag(name, params = {}) parsed, = DockerEngineRuby::ImageTagParams.dump_request(params) @client.request( method: :post, path: ["images/%1$s/tag", name], query: parsed, model: NilClass, options: ) end |