docker-api 1.32.1 → 1.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/docker.rb +1 -1
- data/lib/docker/container.rb +18 -4
- data/lib/docker/version.rb +1 -1
- 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: bb5ad2f5239058b4cbe3ceca06ac1455e659211d
|
|
4
|
+
data.tar.gz: dbeb560e89cacb6fecaf28a2370da23d44350da8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2d333d808a12618046aeb497f11455db5053ae80bcb2fecd404ce94f7fa74f891b1df7f54c77d73a17478f835c721ce4bf9fb29f84553cc6ebd6e3e644866ac
|
|
7
|
+
data.tar.gz: 09f89ca78aef353c1727529649accc22604ad47668809e90e3a370095e93a178baba3299e96617f86ebfc0a3dda2cb172ce70eb198c2543d0c229750797158dd
|
data/README.md
CHANGED
|
@@ -372,6 +372,12 @@ Docker::Container.create(
|
|
|
372
372
|
}
|
|
373
373
|
)
|
|
374
374
|
|
|
375
|
+
# To set container name pass `name` key to options
|
|
376
|
+
Docker::Container.create(
|
|
377
|
+
'name' => 'my-new-container',
|
|
378
|
+
'Image' => 'image-name'
|
|
379
|
+
)
|
|
380
|
+
|
|
375
381
|
# Stores a file with the given content in the container
|
|
376
382
|
container.store_file("/test", "Hello world")
|
|
377
383
|
|
data/lib/docker.rb
CHANGED
|
@@ -14,7 +14,7 @@ require 'open-uri'
|
|
|
14
14
|
require 'excon/middlewares/hijack'
|
|
15
15
|
Excon.defaults[:middlewares].unshift Excon::Middleware::Hijack
|
|
16
16
|
|
|
17
|
-
# The top-level module for this gem.
|
|
17
|
+
# The top-level module for this gem. Its purpose is to hold global
|
|
18
18
|
# configuration variables that are used as defaults in other classes.
|
|
19
19
|
module Docker
|
|
20
20
|
attr_accessor :creds, :logger
|
data/lib/docker/container.rb
CHANGED
|
@@ -158,9 +158,23 @@ class Docker::Container
|
|
|
158
158
|
connection.get(path_for(:logs), opts)
|
|
159
159
|
end
|
|
160
160
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
def stats(options = {})
|
|
162
|
+
if block_given?
|
|
163
|
+
options[:read_timeout] ||= 10
|
|
164
|
+
options[:idempotent] ||= false
|
|
165
|
+
parser = lambda do |chunk, remaining_bytes, total_bytes|
|
|
166
|
+
yield Docker::Util.parse_json(chunk)
|
|
167
|
+
end
|
|
168
|
+
begin
|
|
169
|
+
connection.get(path_for(:stats), nil, {response_block: parser}.merge(options))
|
|
170
|
+
rescue Docker::Error::TimeoutError
|
|
171
|
+
# If the container stops, the docker daemon will hold the connection
|
|
172
|
+
# open forever, but stop sending events.
|
|
173
|
+
# So this Timeout indicates the stream is over.
|
|
174
|
+
end
|
|
175
|
+
else
|
|
176
|
+
Docker::Util.parse_json(connection.get(path_for(:stats), {stream: 0}.merge(options)))
|
|
177
|
+
end
|
|
164
178
|
end
|
|
165
179
|
|
|
166
180
|
def rename(new_name)
|
|
@@ -317,7 +331,7 @@ class Docker::Container
|
|
|
317
331
|
|
|
318
332
|
# Create a new Container.
|
|
319
333
|
def self.create(opts = {}, conn = Docker.connection)
|
|
320
|
-
name = opts.delete('name')
|
|
334
|
+
name = opts.delete('name') || opts.delete(:name)
|
|
321
335
|
query = {}
|
|
322
336
|
query['name'] = name if name
|
|
323
337
|
resp = conn.post('/containers/create', query, :body => opts.to_json)
|
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: 1.
|
|
4
|
+
version: 1.33.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: 2016-
|
|
11
|
+
date: 2016-11-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: excon
|