docker-api 1.28.0 → 1.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +4 -0
- data/lib/docker/container.rb +5 -0
- data/lib/docker/util.rb +2 -0
- data/lib/docker/version.rb +1 -1
- data/spec/docker/container_spec.rb +14 -0
- data/spec/docker_spec.rb +3 -3
- 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: 29ba56360b810e2e0ba6b89d141050924fe411af
|
4
|
+
data.tar.gz: 5e13ee3c1047314c24d22db68061ba92ff9e6244
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f2b8f6a76c9ad7e608b4b8405e5e8456849b81b4570b079a5c58f11940b4f53c9f20c5a7eaeca7b11105945f84811921d5e1aa1aaeaf78b9878dd2716970ca9
|
7
|
+
data.tar.gz: 3b5e1c48e6c7a7afdab6679abca8e8ca99393b7b8e95d4fb0a4eb131f54c3368d5b75253f8d7fd469eff6bbc0b7c6089deab9ebfc8ad7c53738ac96466d25ca6
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -401,6 +401,10 @@ container = Docker::Container.create('Image' => 'ubuntu', 'Cmd' => command, 'Tty
|
|
401
401
|
container.tap(&:start).attach(:tty => true)
|
402
402
|
# => [["I'm a TTY!"], []]
|
403
403
|
|
404
|
+
# Obtaining the current statistics of a container
|
405
|
+
container.stats
|
406
|
+
# => {"read"=>"2016-02-29T20:47:05.221608695Z", "precpu_stats"=>{"cpu_usage"=> ... }
|
407
|
+
|
404
408
|
# Create an Image from a Container's changes.
|
405
409
|
container.commit
|
406
410
|
# => Docker::Image { :id => eaeb8d00efdf, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
|
data/lib/docker/container.rb
CHANGED
@@ -156,6 +156,11 @@ class Docker::Container
|
|
156
156
|
connection.get(path_for(:logs), opts)
|
157
157
|
end
|
158
158
|
|
159
|
+
# TODO: Implement Streaming stats
|
160
|
+
def stats
|
161
|
+
Docker::Util.parse_json(connection.get(path_for(:stats), {stream: 0}))
|
162
|
+
end
|
163
|
+
|
159
164
|
def rename(new_name)
|
160
165
|
query = {}
|
161
166
|
query['name'] = new_name
|
data/lib/docker/util.rb
CHANGED
@@ -185,6 +185,8 @@ module Docker::Util
|
|
185
185
|
body.lines.reverse_each do |line|
|
186
186
|
if (id = line.match(/Successfully built ([a-f0-9]+)/)) && !id[1].empty?
|
187
187
|
return id[1]
|
188
|
+
elsif (id = line.match(/sha256:([a-f0-9]+)/)) && !id[1].empty?
|
189
|
+
return id[1]
|
188
190
|
end
|
189
191
|
end
|
190
192
|
raise UnexpectedResponseError, "Couldn't find id: #{body}"
|
data/lib/docker/version.rb
CHANGED
@@ -81,6 +81,20 @@ describe Docker::Container do
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
+
describe '#stats', docker_1_9: true do
|
85
|
+
subject {
|
86
|
+
described_class.create('Cmd' => "echo hello", 'Image' => 'debian:wheezy')
|
87
|
+
}
|
88
|
+
after(:each) { subject.remove }
|
89
|
+
|
90
|
+
context "when requesting container stats" do
|
91
|
+
let(:output) { subject.stats }
|
92
|
+
it "returns a Hash" do
|
93
|
+
expect(output).to be_a Hash
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
84
98
|
describe '#logs' do
|
85
99
|
subject {
|
86
100
|
described_class.create('Cmd' => "echo hello", 'Image' => 'debian:wheezy')
|
data/spec/docker_spec.rb
CHANGED
@@ -172,9 +172,9 @@ describe Docker do
|
|
172
172
|
let(:info) { subject.info }
|
173
173
|
let(:keys) do
|
174
174
|
%w(Containers Debug DockerRootDir Driver DriverStatus ExecutionDriver ID
|
175
|
-
IPv4Forwarding Images IndexServerAddress
|
176
|
-
|
177
|
-
|
175
|
+
IPv4Forwarding Images IndexServerAddress KernelVersion Labels MemTotal
|
176
|
+
MemoryLimit NCPU NEventsListener NFd NGoroutines Name
|
177
|
+
OperatingSystem SwapLimit)
|
178
178
|
end
|
179
179
|
|
180
180
|
it 'returns the info as a Hash' 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.29.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-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|