module Docker::Porcelain::Image

Private Class Methods

repo_tag_to_hash(repo = nil, tag = nil) click to toggle source
# File lib/docker/porcelain/image.rb, line 70
def self.repo_tag_to_hash repo = nil, tag = nil
  return {} unless repo
  repo, tag = repo.split ':' unless tag
  { 'repo' => repo, 'tag' => tag }
end

Public Instance Methods

parent() click to toggle source

@return [Docker::Image] the parent image @return [nil] if the image is +FROM scratch+

# File lib/docker/porcelain/image.rb, line 33
def parent
  return nil if (parent = info['Parent']).empty?
  Docker::Porcelain::Image[parent]
end
tag(*args) click to toggle source

Tag the image @overload tag(repo, tag, opts)

@param [String] repo the repository to tag in
@param [String] tag the new tag
@option opts [Boolean] force whether to replace the tag if it
  already exists

@overload tag(repo_tag, opts)

@param [String] repo_tag the repository to tag in with optional tag;
  in 'repo:tag' or 'repo' format
@option opts [Boolean] force whether to replace the tag if it
  already exists

@overload tag(opts)

@option opts [String] repo the repository to tag in
@option opts [String] tag the new tag
@option opts [Boolean] force whether to replace the tag if it
  already exists

@return [void]

Calls superclass method
# File lib/docker/porcelain/image.rb, line 55
def tag *args
  strargs, rest = args.partition { |arg| arg.respond_to? :to_str }

  # rest should be [opts] or empty
  rest.length < 2 or
      fail ArgumentError, 'expected args: [repo [tag]] [options]'
  opts = rest.first || {}

  super opts.merge Image.repo_tag_to_hash *strargs
end
tags() click to toggle source

@return [Array<String>] repository tags of the image

# File lib/docker/porcelain/image.rb, line 23
def tags
  # Image can have incomplete info, refresh then
  refresh! unless info['RepoTags']

  # docker returns '<none>:<none>' for an untagged repo
  info['RepoTags'] - ['<none>:<none>']
end