docker-api 1.34.2 → 2.0.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +4 -4
- data/lib/docker.rb +1 -12
- data/lib/docker/connection.rb +1 -1
- data/lib/docker/container.rb +2 -12
- data/lib/docker/event.rb +3 -1
- data/lib/docker/image.rb +2 -2
- data/lib/docker/network.rb +3 -3
- data/lib/docker/version.rb +1 -4
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 88fd03d58560759042d6b5513da603fa2db7e1553e47ddcd85cf6af9df34ecf5
|
4
|
+
data.tar.gz: cccb4daff0e134328e485a81862609371990697af2c36a4694cb9ba2053e8423
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce528e7f874a062c36fc71c531fcc038501495a9cddd71b6187169ea2278e404cb6a9fdf9d07f39327613bde8c99403d093b471e7d56717b1cb93e21f1f26d10
|
7
|
+
data.tar.gz: 04f96ad64f0aab19bd1d96d8816b247f55530b110c8717e4ee24447036302ff3ddd79070768ede3858b1c08ebc3f91b998191d48980396c1ab94c47a0c25c4ba
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
docker-api
|
2
2
|
==========
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/docker-api.svg)](https://badge.fury.io/rb/docker-api) [![travis-ci](https://travis-ci.org/swipely/docker-api.svg?branch=master)](https://travis-ci.org/swipely/docker-api) [![Code Climate](https://codeclimate.com/github/swipely/docker-api.svg)](https://codeclimate.com/github/swipely/docker-api)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/docker-api.svg)](https://badge.fury.io/rb/docker-api) [![travis-ci](https://travis-ci.org/swipely/docker-api.svg?branch=master)](https://travis-ci.org/swipely/docker-api) [![Code Climate](https://codeclimate.com/github/swipely/docker-api.svg)](https://codeclimate.com/github/swipely/docker-api)
|
4
4
|
|
5
|
-
This gem provides an object-oriented interface to the [Docker
|
5
|
+
This gem provides an object-oriented interface to the [Docker Engine API](https://docs.docker.com/develop/sdk/). Every method listed there is implemented. At the time of this writing, docker-api is meant to interface with Docker version 1.4.*
|
6
6
|
|
7
7
|
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.
|
8
8
|
|
@@ -36,7 +36,7 @@ docker-api is designed to be very lightweight. Almost no state is cached (aside
|
|
36
36
|
|
37
37
|
## Starting up
|
38
38
|
|
39
|
-
Follow the [installation instructions](https://docs.docker.com/
|
39
|
+
Follow the [installation instructions](https://docs.docker.com/install/), and then run:
|
40
40
|
|
41
41
|
```shell
|
42
42
|
$ sudo docker -d
|
@@ -52,7 +52,7 @@ If you're running Docker locally as a socket, there is no setup to do in Ruby. I
|
|
52
52
|
Docker.url = 'tcp://example.com:5422'
|
53
53
|
```
|
54
54
|
|
55
|
-
Two things to note here. The first is that this gem uses [excon](
|
55
|
+
Two things to note here. The first is that this gem uses [excon](https://github.com/excon/excon), so any of the options that are valid for `Excon.new` are also valid for `Docker.options`. Second, by default Docker runs on a socket. The gem will assume you want to connect to the socket unless you specify otherwise.
|
56
56
|
|
57
57
|
Also, you may set the above variables via `ENV` variables. For example:
|
58
58
|
|
data/lib/docker.rb
CHANGED
@@ -129,19 +129,8 @@ module Docker
|
|
129
129
|
raise Docker::Error::AuthenticationError
|
130
130
|
end
|
131
131
|
|
132
|
-
# When the correct version of Docker is installed, returns true. Otherwise,
|
133
|
-
# raises a VersionError.
|
134
|
-
def validate_version!
|
135
|
-
Docker.info
|
136
|
-
true
|
137
|
-
rescue Docker::Error::TimeoutError
|
138
|
-
raise
|
139
|
-
rescue Docker::Error::DockerError
|
140
|
-
raise Docker::Error::VersionError, "Expected API Version: #{API_VERSION}"
|
141
|
-
end
|
142
|
-
|
143
132
|
module_function :default_socket_url, :env_url, :url, :url=, :env_options,
|
144
133
|
:options, :options=, :creds, :creds=, :logger, :logger=,
|
145
134
|
:connection, :reset!, :reset_connection!, :version, :info,
|
146
|
-
:ping, :authenticate!, :
|
135
|
+
:ping, :authenticate!, :ssl_options
|
147
136
|
end
|
data/lib/docker/connection.rb
CHANGED
@@ -80,7 +80,7 @@ private
|
|
80
80
|
user_agent = "Swipely/Docker-API #{Docker::VERSION}"
|
81
81
|
{
|
82
82
|
:method => http_method,
|
83
|
-
:path =>
|
83
|
+
:path => path,
|
84
84
|
:query => query,
|
85
85
|
:headers => { 'Content-Type' => content_type,
|
86
86
|
'User-Agent' => user_agent,
|
data/lib/docker/container.rb
CHANGED
@@ -189,7 +189,7 @@ class Docker::Container
|
|
189
189
|
end
|
190
190
|
|
191
191
|
def streaming_logs(opts = {}, &block)
|
192
|
-
stack_size = opts.delete('stack_size') || -1
|
192
|
+
stack_size = opts.delete('stack_size') || opts.delete(:stack_size) || -1
|
193
193
|
tty = opts.delete('tty') || opts.delete(:tty) || false
|
194
194
|
msgs = Docker::MessagesStack.new(stack_size)
|
195
195
|
excon_params = {response_block: Docker::Util.attach_for(block, msgs, tty), idempotent: false}
|
@@ -266,16 +266,6 @@ class Docker::Container
|
|
266
266
|
end
|
267
267
|
end
|
268
268
|
|
269
|
-
def copy(path, &block)
|
270
|
-
connection.post(
|
271
|
-
path_for(:copy),
|
272
|
-
{},
|
273
|
-
body: MultiJson.dump('Resource' => path),
|
274
|
-
response_block: block
|
275
|
-
)
|
276
|
-
self
|
277
|
-
end
|
278
|
-
|
279
269
|
def archive_out(path, &block)
|
280
270
|
connection.get(
|
281
271
|
path_for(:archive),
|
@@ -343,7 +333,7 @@ class Docker::Container
|
|
343
333
|
|
344
334
|
# Return the container with specified ID
|
345
335
|
def self.get(id, opts = {}, conn = Docker.connection)
|
346
|
-
container_json = conn.get("/containers/#{
|
336
|
+
container_json = conn.get("/containers/#{id}/json", opts)
|
347
337
|
hash = Docker::Util.parse_json(container_json) || {}
|
348
338
|
new(conn, hash)
|
349
339
|
end
|
data/lib/docker/event.rb
CHANGED
@@ -29,7 +29,9 @@ class Docker::Event
|
|
29
29
|
|
30
30
|
def stream(opts = {}, conn = Docker.connection, &block)
|
31
31
|
conn.get('/events', opts, :response_block => lambda { |b, r, t|
|
32
|
-
|
32
|
+
b.each_line do |line|
|
33
|
+
block.call(new_event(line, r, t))
|
34
|
+
end
|
33
35
|
})
|
34
36
|
end
|
35
37
|
|
data/lib/docker/image.rb
CHANGED
@@ -126,7 +126,7 @@ class Docker::Image
|
|
126
126
|
|
127
127
|
# Return a specific image.
|
128
128
|
def get(id, opts = {}, conn = Docker.connection)
|
129
|
-
image_json = conn.get("/images/#{
|
129
|
+
image_json = conn.get("/images/#{id}/json", opts)
|
130
130
|
hash = Docker::Util.parse_json(image_json) || {}
|
131
131
|
new(conn, hash)
|
132
132
|
end
|
@@ -174,7 +174,7 @@ class Docker::Image
|
|
174
174
|
# By using compare_by_identity we can create a Hash that has
|
175
175
|
# the same key multiple times.
|
176
176
|
query = {}.tap(&:compare_by_identity)
|
177
|
-
Array(names).each { |name| query['names'.dup] =
|
177
|
+
Array(names).each { |name| query['names'.dup] = name }
|
178
178
|
conn.get(
|
179
179
|
'/images/get',
|
180
180
|
query,
|
data/lib/docker/network.rb
CHANGED
@@ -34,7 +34,7 @@ class Docker::Network
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def reload
|
37
|
-
network_json = @connection.get("/networks/#{
|
37
|
+
network_json = @connection.get("/networks/#{@id}")
|
38
38
|
hash = Docker::Util.parse_json(network_json) || {}
|
39
39
|
@info = hash
|
40
40
|
end
|
@@ -51,7 +51,7 @@ class Docker::Network
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def get(id, opts = {}, conn = Docker.connection)
|
54
|
-
network_json = conn.get("/networks/#{
|
54
|
+
network_json = conn.get("/networks/#{id}", opts)
|
55
55
|
hash = Docker::Util.parse_json(network_json) || {}
|
56
56
|
new(conn, hash)
|
57
57
|
end
|
@@ -62,7 +62,7 @@ class Docker::Network
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def remove(id, opts = {}, conn = Docker.connection)
|
65
|
-
conn.delete("/networks/#{
|
65
|
+
conn.delete("/networks/#{id}", opts)
|
66
66
|
nil
|
67
67
|
end
|
68
68
|
alias_method :delete, :remove
|
data/lib/docker/version.rb
CHANGED
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:
|
4
|
+
version: 2.0.0.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swipely, Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -179,7 +179,7 @@ homepage: https://github.com/swipely/docker-api
|
|
179
179
|
licenses:
|
180
180
|
- MIT
|
181
181
|
metadata: {}
|
182
|
-
post_install_message:
|
182
|
+
post_install_message:
|
183
183
|
rdoc_options: []
|
184
184
|
require_paths:
|
185
185
|
- lib
|
@@ -190,13 +190,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
190
190
|
version: '0'
|
191
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
192
|
requirements:
|
193
|
-
- - "
|
193
|
+
- - ">"
|
194
194
|
- !ruby/object:Gem::Version
|
195
|
-
version:
|
195
|
+
version: 1.3.1
|
196
196
|
requirements: []
|
197
|
-
|
198
|
-
|
199
|
-
signing_key:
|
197
|
+
rubygems_version: 3.1.2
|
198
|
+
signing_key:
|
200
199
|
specification_version: 4
|
201
200
|
summary: A simple REST client for the Docker Remote API
|
202
201
|
test_files: []
|