Class: Docker::Container
- Inherits:
-
Object
- Object
- Docker::Container
- Includes:
- Model
- Defined in:
- lib/docker/container.rb
Overview
This class represents a Docker Container. It’s important to note that nothing is cached so that the information is always up to date.
Instance Attribute Summary
Attributes included from Model
Instance Method Summary collapse
-
#attach(options = {}) ⇒ Object
Attach to a container’s standard streams / logs.
-
#commit(options = {}) ⇒ Object
Create an Image from a Container’s change.s.
-
#export(&block) ⇒ Object
Export the Container as a tar.
Methods included from Model
Instance Method Details
#attach(options = {}) ⇒ Object
Attach to a container’s standard streams / logs.
36 37 38 39 |
# File 'lib/docker/container.rb', line 36 def attach( = {}) = { :stream => true, :stdout => true }.merge() connection.post("/containers/#{id}/attach", ) end |
#commit(options = {}) ⇒ Object
Create an Image from a Container’s change.s
42 43 44 45 46 |
# File 'lib/docker/container.rb', line 42 def commit( = {}) .merge!('container' => self.id[0..7]) hash = JSON.parse(connection.request(:post, '/commit', )) Docker::Image.send(:new, :id => hash['Id'], :connection => self.connection) end |
#export(&block) ⇒ Object
Export the Container as a tar.
30 31 32 33 |
# File 'lib/docker/container.rb', line 30 def export(&block) connection.get("/containers/#{id}/export", nil, :response_block => block) true end |