Sha256: 5feff74093906c170acd09c2e5128a0c87ba102c90fbe3d4fec0ce773733362c
Contents?: true
Size: 1.62 KB
Versions: 2
Compression:
Stored size: 1.62 KB
Contents
# This class represents a Docker Container. It's important to note that nothing # is cached so that the information is always up to date. class Docker::Container include Docker::Model resource_prefix '/containers' create_request do |body| response = self.connection.post( :path => '/containers/create', :headers => { 'Content-Type' => 'text/plain', 'User-Agent' => "Docker-Client/0.4.6" }, :body => body.to_json, :expects => (200..204) ) @id = JSON.parse(response.body)['Id'] self end # Export the Container as a .tgz. get :export # Get more information about the Container. get :json # Wait for the current command to finish executing. post :wait # Start the Container. post :start # Inspect the Container's changes to the filesysetem get :changes # Stop the Container. post :stop # Kill the Container. post :kill # Restart the Container post :restart # Attach to a container's standard streams / logs. def attach(options = {}) options = { :stream => true, :stdout => true }.merge(options) self.connection.post( :path => "/containers/#{self.id}/attach", :headers => { 'Content-Type' => 'text/plain', 'User-Agent' => "Docker-Client/0.4.6" }, :query => options, :expects => (200..204) ).body end # Create an Image from a Container's change.s def commit(options = {}) options.merge!('container' => self.id[0..7]) hash = self.connection.json_request(:post, '/commit', options) Docker::Image.send(:new, :id => hash['Id'], :connection => self.connection) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
docker-api-1.0.1 | lib/docker/container.rb |
docker-api-1.0.0 | lib/docker/container.rb |