README.md in docker-api-1.13.0 vs README.md in docker-api-1.13.1
- old
+ new
@@ -1,10 +1,10 @@
docker-api
==========
[](http://badge.fury.io/rb/docker-api) [](https://travis-ci.org/swipely/docker-api) [](https://codeclimate.com/github/swipely/docker-api) [](https://gemnasium.com/swipely/docker-api)
-This gem provides an object-oriented interface to the [Docker Remote API](http://docs.docker.io/en/latest/reference/api/docker_remote_api/). Every method listed there is implemented. At the time of this writing, docker-api is meant to interface with Docker version 0.11.*.
+This gem provides an object-oriented interface to the [Docker Remote API](http://docs.docker.io/en/latest/reference/api/docker_remote_api/). Every method listed there is implemented. At the time of this writing, docker-api is meant to interface with Docker version 1.0.*
If you're interested in using Docker to package your apps, we recommend the [dockly](https://github.com/swipely/dockly) gem. Dockly provides a simple DSL for describing Docker containers that install as Debian packages and are controlled by upstart scripts.
Installation
------------
@@ -103,14 +103,10 @@
# Create an Image.
Docker::Image.create('fromImage' => 'base')
# => Docker::Image { :id => ae7ffbcd1, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
-# Insert a file into an Image from a url.
-image.insert('path' => '/google', 'url' => 'http://google.com')
-# => Docker::Image { :id => 11ef6c882, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
-
# Insert a local file into an Image.
image.insert_local('localPath' => 'Gemfile', 'outputPath' => '/')
# => Docker::Image { :id => 682ea192f, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
# Insert multiple local files into an Image.
@@ -198,14 +194,26 @@
# Restart the Container.
container.restart
# => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
+# Pause the running Container processes.
+container.pause
+# => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
+
+# Unpause the running Container processes.
+container.unpause
+# => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
+
# Kill the command running in the Container.
container.kill
# => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
+# Kill the Container specifying the kill signal.
+container.kill(:signal => "SIGHUP")
+# => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
+
# Return the currently executing processes in a Container.
container.top
# => [{"PID"=>"4851", "TTY"=>"pts/0", "TIME"=>"00:00:00", "CMD"=>"lxc-start"}]
# Export a Container. Since an export is typically at least 300M, chunks of the
@@ -236,11 +244,11 @@
container.wait(15)
# => {'StatusCode'=>0}
# Attach to the Container. Currently, the below options are the only valid ones.
# By default, :stream, :stdout, and :stderr are set.
-container.attach(:stream => true, :stdin => nil, :stdout => true, :stderr => true, :logs => true)
+container.attach(:stream => true, :stdin => nil, :stdout => true, :stderr => true, :logs => true, :tty => false)
# => [["bin\nboot\ndev\netc\nhome\nlib\nlib64\nmedia\nmnt\nopt\nproc\nroot\nrun\nsbin\nselinux\nsrv\nsys\ntmp\nusr\nvar", []]
# If you wish to stream the attach method, a block may be supplied.
container = Docker::Container.create('Image' => 'base', 'Cmd' => ['find / -name *'])
container.tap(&:start).attach { |stream, chunk| puts "#{stream}: #{chunk}" }
@@ -250,10 +258,16 @@
# If you want to attach to stdin of the container, supply an IO-like object:
container = Docker::Container.create('Image' => 'base', 'Cmd' => ['cat'], 'OpenStdin' => true, 'StdinOnce' => true)
container.tap(&:start).attach(stdin: StringIO.new("foo\nbar\n"))
# => [["foo\nbar\n"], []]
+# If the container has TTY enabled, set `tty => true` to get the raw stream:
+command = ["bash", "-c", "if [ -t 1 ]; then echo -n \"I'm a TTY!\"; fi"]
+container = Docker::Container.create('Image' => 'ubuntu', 'Cmd' => command, 'Tty' => true)
+container.tap(&:start).attach(:tty => true)
+# => [["I'm a TTY!"], []]
+
# Create an Image from a Container's changes.
container.commit
# => Docker::Image { :id => eaeb8d00efdf, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
# Commit the Container and run a new command. The second argument is the number
@@ -303,5 +317,10 @@
image = Docker::Image.create('fromImage' => 'repo', 'tag' => 'tag')
image = image.insert_local('localPath' => 'some-file.tar.gz', 'outputPath' => '/')
image.tag('repo' => 'repo', 'tag' => 'new_tag')
end
```
+
+## Not supported (yet)
+
+* Generating a tarball of images and metadata for a repository specified by a name: https://docs.docker.com/reference/api/docker_remote_api_v1.12/#get-a-tarball-containing-all-images-and-tags-in-a-repository
+* Load a tarball generated from docker that contains all the images and metadata of a repository: https://docs.docker.com/reference/api/docker_remote_api_v1.12/#load-a-tarball-with-a-set-of-images-and-tags-into-docker