class Docker::Container

Public Instance Methods

archive_get(path = '/', &blk) click to toggle source
# File lib/drydock/docker_api_patch.rb, line 28
def archive_get(path = '/', &blk)
  query = { 'path' => path }
  connection.get(path_for(:archive), query, response_block: blk)
  self
end
archive_head(path = '/', &blk) click to toggle source
# File lib/drydock/docker_api_patch.rb, line 34
def archive_head(path = '/', &blk)
  query = { 'path' => path }
  response = connection.raw_request(:head, path_for(:archive), query, response_block: blk)

  return if response.nil?
  return if response.headers.empty?
  return unless response.headers.key?('X-Docker-Container-Path-Stat')

  ContainerPathStat.new(response.headers['X-Docker-Container-Path-Stat'])
rescue Docker::Error::NotFoundError
  nil
end
archive_put(path = '/', overwrite: false, &blk) click to toggle source
# File lib/drydock/docker_api_patch.rb, line 47
def archive_put(path = '/', overwrite: false, &blk)
  headers = { 'Content-Type' => 'application/x-tar' }
  query   = { 'path' => path, 'noOverwriteDirNonDir' => overwrite }

  output = StringIO.new
  blk.call(output)
  output.rewind

  connection.put(path_for(:archive), query, headers: headers, body: output)
  self
end