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.
554 555 556 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 554 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
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 163 164 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 120 def build(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 ] parsed, = DockerEngineRuby::ImageBuildParams.dump_request(params) @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
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 180 def build_prune(params = {}) parsed, = DockerEngineRuby::ImageBuildPruneParams.dump_request(params) query = DockerEngineRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :post, path: "build/prune", query: query.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
270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 270 def commit(params = {}) query_params = [:author, :changes, :comment, :container, :pause, :repo, :tag] parsed, = DockerEngineRuby::ImageCommitParams.dump_request(params) query = DockerEngineRuby::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :post, path: "commit", query: query, 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
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 45 def delete(name, params = {}) parsed, = DockerEngineRuby::ImageDeleteParams.dump_request(params) query = DockerEngineRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :delete, path: ["images/%1$s", name], query: query, model: DockerEngineRuby::Internal::Type::ArrayOf[DockerEngineRuby::DeleteItem], options: ) end |
#get(name, platform: nil, request_options: {}) ⇒ StringIO
Export an image
295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 295 def get(name, params = {}) parsed, = DockerEngineRuby::ImageGetParams.dump_request(params) query = DockerEngineRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["images/%1$s/get", name], query: query, headers: {"accept" => "application/octet-stream"}, model: StringIO, options: ) end |
#get_all(names: nil, platform: nil, request_options: {}) ⇒ StringIO
Export several images
319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 319 def get_all(params = {}) parsed, = DockerEngineRuby::ImageGetAllParams.dump_request(params) query = DockerEngineRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "images/get", query: query, 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
343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 343 def history(name, params = {}) parsed, = DockerEngineRuby::ImageHistoryParams.dump_request(params) query = DockerEngineRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["images/%1$s/history", name], query: query, model: DockerEngineRuby::Internal::Type::ArrayOf[DockerEngineRuby::HistoryItem], options: ) end |
#inspect_(name, manifests: nil, request_options: {}) ⇒ DockerEngineRuby::Models::Image
Inspect an image
366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 366 def inspect_(name, params = {}) parsed, = DockerEngineRuby::ImageInspectParams.dump_request(params) query = DockerEngineRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["images/%1$s/json", name], query: query, 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 30 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 20 def list(params = {}) parsed, = DockerEngineRuby::ImageListParams.dump_request(params) query = DockerEngineRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "images/json", query: query.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
393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 393 def load_(params) parsed, = DockerEngineRuby::ImageLoadParams.dump_request(params) query = DockerEngineRuby::Internal::Util.encode_query_params(parsed.except(:body)) @client.request( method: :post, path: "images/load", query: query, headers: {"content-type" => "application/octet-stream"}, body: parsed[:body], model: NilClass, options: ) end |
#prune(filters: nil, request_options: {}) ⇒ DockerEngineRuby::Models::ImagePruneResponse
Delete unused images
417 418 419 420 421 422 423 424 425 426 427 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 417 def prune(params = {}) parsed, = DockerEngineRuby::ImagePruneParams.dump_request(params) query = DockerEngineRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :post, path: "images/prune", query: query, 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
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 456 def pull(params) query_params = [:changes, :from_image, :from_src, :message, :platform, :repo, :tag] parsed, = DockerEngineRuby::ImagePullParams.dump_request(params) @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
489 490 491 492 493 494 495 496 497 498 499 500 501 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 489 def push(name, params) query_params = [:platform, :tag] parsed, = DockerEngineRuby::ImagePushParams.dump_request(params) query = DockerEngineRuby::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :post, path: ["images/%1$s/push", name], query: query, 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
515 516 517 518 519 520 521 522 523 524 525 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 515 def search(params) parsed, = DockerEngineRuby::ImageSearchParams.dump_request(params) query = DockerEngineRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "images/search", query: query, model: DockerEngineRuby::Internal::Type::ArrayOf[DockerEngineRuby::Models::ImageSearchResponseItem], options: ) end |
#tag(name, repo: nil, tag: nil, request_options: {}) ⇒ nil
Tag an image
539 540 541 542 543 544 545 546 547 548 549 |
# File 'lib/docker_engine_ruby/resources/images.rb', line 539 def tag(name, params = {}) parsed, = DockerEngineRuby::ImageTagParams.dump_request(params) query = DockerEngineRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :post, path: ["images/%1$s/tag", name], query: query, model: NilClass, options: ) end |