README.md in docker-api-1.5.4 vs README.md in docker-api-1.6.0
- old
+ new
@@ -1,10 +1,10 @@
docker-api
==========
[![Gem Version](https://badge.fury.io/rb/docker-api.png)](http://badge.fury.io/rb/docker-api) [![travis-ci](https://travis-ci.org/swipely/docker-api.png?branch=master)](https://travis-ci.org/swipely/docker-api) [![Code Climate](https://codeclimate.com/github/swipely/docker-api.png)](https://codeclimate.com/github/swipely/docker-api) [![Dependency Status](https://gemnasium.com/swipely/docker-api.png)](https://gemnasium.com/swipely/docker-api)
-This gem provides an object-oriented interface to the [Docker Remote API](http://docs.docker.io/en/latest/api/docker_remote_api_v1.4/). Every method listed there is implemented, with the exception of attaching to the STDIN of a Container. At the time of this writing, docker-api is meant to interface with Docker version 0.5.*.
+This gem provides an object-oriented interface to the [Docker Remote API](http://docs.docker.io/en/latest/api/docker_remote_api_v1.4/). Every method listed there is implemented, with the exception of attaching to the STDIN of a Container. At the time of this writing, docker-api is meant to interface with Docker version 0.6.*.
Installation
------------
Add this line to your application's Gemfile:
@@ -40,31 +40,40 @@
$ sudo docker -d
```
This will daemonize Docker so that it can be used for the remote API calls.
-If you're running Docker locally, there is no setup to do in Ruby. If you're not, you'll have to point the gem to your server. For example:
+If you're running Docker locally as a socket, there is no setup to do in Ruby. If you're not or change the path of the socket, you'll have to point the gem to your socket or local/remote port. For example:
```ruby
-Docker.url = 'http://example.com'
-Docker.options = { :port => 5422 }
+Docker.url = 'http://example.com:5422'
```
-Two things to note here. The first is that this gem uses [excon](http://www.github.com/geemus/excon), so any of the options that are valid for `Excon.new` are alse valid for `Docker.options`. Second, by default Docker runs on port 4243. The gem will assume you want to connnect to port 4243 unless you specify otherwise.
+Two things to note here. The first is that this gem uses [excon](http://www.github.com/geemus/excon), so any of the options that are valid for `Excon.new` are alse valid for `Docker.options`. Second, by default Docker runs on a socket. The gem will assume you want to connnect to the socket unless you specify otherwise.
Also, you may set the above variables via `ENV` variables. For example:
```shell
-$ DOCKER_HOST=example.com DOCKER_PORT=1000 irb
+$ DOCKER_URL=unix:///var/docker.sock irb
irb(main):001:0> require 'docker'
=> true
irb(main):002:0> Docker.url
-=> http://example.com
+=> "unix:///var/docker.sock"
irb(main):003:0> Docker.options
-=> {:port=>1000}
+=> {}
```
+```shell
+$ DOCKER_URL=http://example.com:1000 irb
+irb(main):001:0> require 'docker'
+=> true
+irb(main):003:0> Docker.url
+=> "http://example.com:1000"
+irb(main):004:0> Docker.options
+=> {}
+```
+
Before doing anything else, ensure you have the correct version of the Docker API. To do this, run `Docker.validate_version!`. If your installed version is not supported, a `Docker::Error::VersionError` is raised.
## Global calls
All of the following examples require a connection to a Docker server. See the <a href="#starting-up">Starting up</a> section above for more information.
@@ -89,11 +98,11 @@
```ruby
require 'docker'
# => true
# Create an Image.
-Docker::Image.create('fromRepo' => 'base')
+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} } }
@@ -250,10 +259,10 @@
By default, each object connects to the connection specified by `Docker.connection`. If you need to connect to multiple servers, you can do so by specifying the connection on `#new` or in the utilizing class method. For example:
```ruby
require 'docker'
-Docker::Container.all({}, Docker::Connection.new(:url => 'http://example.com'))
+Docker::Container.all({}, Docker::Connection.new('http://example.com:4243', {}))
```
## Known Issues
- `Docker::Container#attach` cannot attach to STDIN