docker-api 1.20.0 → 1.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cane +1 -0
- data/README.md +19 -1
- data/lib/docker.rb +11 -1
- data/lib/docker/version.rb +1 -1
- data/spec/docker_spec.rb +27 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c60e727e41589271f61a49d530a0dded82d81448
|
4
|
+
data.tar.gz: da74b0b29b1732a2aaabca6dc0dddca84d628a9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dd6e22287a43e0fb91fddd529c371c44e0b2c5de387e10d973be9d71de3b917c887f7e3b9fd20771be6210b4480e2f59f78f9d7f16dc29fb0de053343bc9bf1
|
7
|
+
data.tar.gz: e455ff3b6fda2c4d3eb86d044b0bd9a09705b6bcfa6f969576e0d142a8f8fb39243b4fcc242a522840a773551321feab29308d4bd6c951fe11fbe8c9a2de0a58
|
data/.cane
CHANGED
data/README.md
CHANGED
@@ -44,7 +44,9 @@ $ sudo docker -d
|
|
44
44
|
|
45
45
|
This will daemonize Docker so that it can be used for the remote API calls.
|
46
46
|
|
47
|
-
|
47
|
+
### Host
|
48
|
+
|
49
|
+
If you're running Docker locally as a socket, there is no setup to do in Ruby. If you're not using a socket or have changed the path of the socket, you'll have to point the gem to your socket or local/remote port. For example:
|
48
50
|
|
49
51
|
```ruby
|
50
52
|
Docker.url = 'tcp://example.com:5422'
|
@@ -76,6 +78,22 @@ irb(main):004:0> Docker.options
|
|
76
78
|
|
77
79
|
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.
|
78
80
|
|
81
|
+
### SSL
|
82
|
+
|
83
|
+
When running docker using SSL, setting the DOCKER_CERT_PATH will configure docker-api to use SSL.
|
84
|
+
The cert path is a folder that contains the cert, key and cacert files.
|
85
|
+
docker-api is expecting the files to be named: cert.pem, key.pem, and ca.pem.
|
86
|
+
If your files are named different, you'll want to set your options explicity:
|
87
|
+
|
88
|
+
```
|
89
|
+
Docker.options = {
|
90
|
+
client_cert: File.join(cert_path, 'cert.pem'),
|
91
|
+
client_key: File.join(cert_path, 'key.pem'),
|
92
|
+
ssl_ca_file: File.join(cert_path, 'ca.pem'),
|
93
|
+
scheme: 'https'
|
94
|
+
}
|
95
|
+
```
|
96
|
+
|
79
97
|
## Global calls
|
80
98
|
|
81
99
|
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.
|
data/lib/docker.rb
CHANGED
@@ -46,6 +46,16 @@ module Docker
|
|
46
46
|
client_key: File.join(cert_path, 'key.pem'),
|
47
47
|
ssl_ca_file: File.join(cert_path, 'ca.pem'),
|
48
48
|
scheme: 'https'
|
49
|
+
}.merge(ssl_options)
|
50
|
+
else
|
51
|
+
{}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def ssl_options
|
56
|
+
if ENV['DOCKER_SSL_VERIFY'] == 'false'
|
57
|
+
{
|
58
|
+
ssl_verify_peer: false
|
49
59
|
}
|
50
60
|
else
|
51
61
|
{}
|
@@ -121,5 +131,5 @@ module Docker
|
|
121
131
|
module_function :default_socket_url, :env_url, :url, :url=, :env_options,
|
122
132
|
:options, :options=, :creds, :creds=, :logger, :logger=,
|
123
133
|
:connection, :reset!, :reset_connection!, :version, :info,
|
124
|
-
:authenticate!, :validate_version
|
134
|
+
:authenticate!, :validate_version!, :ssl_options
|
125
135
|
end
|
data/lib/docker/version.rb
CHANGED
data/spec/docker_spec.rb
CHANGED
@@ -82,6 +82,7 @@ describe Docker do
|
|
82
82
|
.and_return('tcp://someserver:8103')
|
83
83
|
allow(ENV).to receive(:[]).with('DOCKER_CERT_PATH')
|
84
84
|
.and_return('/boot2dockert/cert/path')
|
85
|
+
allow(ENV).to receive(:[]).with('DOCKER_SSL_VERIFY').and_return(nil)
|
85
86
|
Docker.reset!
|
86
87
|
end
|
87
88
|
|
@@ -96,6 +97,32 @@ describe Docker do
|
|
96
97
|
its(:url) { should == 'tcp://someserver:8103' }
|
97
98
|
its(:connection) { should be_a Docker::Connection }
|
98
99
|
end
|
100
|
+
|
101
|
+
context "when the DOCKER_CERT_PATH and DOCKER_SSL_VERIFY ENV variables are set" do
|
102
|
+
before do
|
103
|
+
allow(ENV).to receive(:[]).with('DOCKER_URL').and_return(nil)
|
104
|
+
allow(ENV).to receive(:[]).with('DOCKER_HOST')
|
105
|
+
.and_return('tcp://someserver:8103')
|
106
|
+
allow(ENV).to receive(:[]).with('DOCKER_CERT_PATH')
|
107
|
+
.and_return('/boot2dockert/cert/path')
|
108
|
+
allow(ENV).to receive(:[]).with('DOCKER_SSL_VERIFY')
|
109
|
+
.and_return('false')
|
110
|
+
Docker.reset!
|
111
|
+
end
|
112
|
+
|
113
|
+
its(:options) {
|
114
|
+
should == {
|
115
|
+
client_cert: '/boot2dockert/cert/path/cert.pem',
|
116
|
+
client_key: '/boot2dockert/cert/path/key.pem',
|
117
|
+
ssl_ca_file: '/boot2dockert/cert/path/ca.pem',
|
118
|
+
scheme: 'https',
|
119
|
+
ssl_verify_peer: false
|
120
|
+
}
|
121
|
+
}
|
122
|
+
its(:url) { should == 'tcp://someserver:8103' }
|
123
|
+
its(:connection) { should be_a Docker::Connection }
|
124
|
+
end
|
125
|
+
|
99
126
|
end
|
100
127
|
|
101
128
|
describe '#reset_connection!' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docker-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swipely, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|