docker-api 1.27.0 → 1.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -1
- data/lib/docker/image.rb +2 -2
- data/lib/docker/version.rb +1 -1
- data/spec/docker/image_spec.rb +23 -11
- 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: 208227d2b48722c6c994b7182065a13ee1e478ce
|
4
|
+
data.tar.gz: 7fe1de106942c93a80884c0b5ca65a06bf237e81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8420bbc610fa614cd590c9ff449a98e237c9bdaa20c91b03954c2c9d797849cb48f97e2048ee4589b095f0448fe9ab9e46685dcbe884d232cb3c9339313c47e3
|
7
|
+
data.tar.gz: 64af52f1ed2c4a9b25c69759c06d77745e8ce7843db8675247b6225318b809754b4c336f50ebae01fbfcd20cc3b4adde22042c2eeb9fb96e7a03aba85a7b2a8d
|
data/README.md
CHANGED
@@ -108,7 +108,7 @@ require 'docker'
|
|
108
108
|
Docker.version
|
109
109
|
# => { 'Version' => '0.5.2', 'GoVersion' => 'go1.1' }
|
110
110
|
|
111
|
-
# docker command for reference: docker info
|
111
|
+
# docker command for reference: docker info
|
112
112
|
Docker.info
|
113
113
|
# => { "Debug" => false, "Containers" => 187, "Images" => 196, "NFd" => 10, "NGoroutines" => 9, "MemoryLimit" => true }
|
114
114
|
|
@@ -245,6 +245,16 @@ Docker::Image.get('df4f1bdecf40')
|
|
245
245
|
Docker::Image.exist?('ef723dcdac09')
|
246
246
|
# => true
|
247
247
|
|
248
|
+
# Load an image from the file system
|
249
|
+
Docker::Image.load('./my-image.tar')
|
250
|
+
# => ""
|
251
|
+
|
252
|
+
# An IO object may also be specified for loading
|
253
|
+
File.open('./my-image.tar', 'rb') do |file|
|
254
|
+
Docker::Image.load(file)
|
255
|
+
end
|
256
|
+
# => ""
|
257
|
+
|
248
258
|
# Export multiple images to a single tarball
|
249
259
|
# docker command for reference: docker save my_image1 my_image2:not_latest > my_export.tar
|
250
260
|
names = %w( my_image1 my_image2:not_latest )
|
data/lib/docker/image.rb
CHANGED
@@ -171,14 +171,14 @@ class Docker::Image
|
|
171
171
|
# Load a tar Image
|
172
172
|
def load(tar, opts = {}, conn = Docker.connection, creds = nil, &block)
|
173
173
|
headers = build_headers(creds)
|
174
|
+
io = tar.is_a?(String) ? File.open(tar, 'rb') : tar
|
174
175
|
body = ""
|
175
|
-
f = File.open(tar,'rb')
|
176
176
|
conn.post(
|
177
177
|
'/images/load',
|
178
178
|
opts,
|
179
179
|
:headers => headers,
|
180
180
|
:response_block => response_block(body, &block)
|
181
|
-
) {
|
181
|
+
) { io.read(Excon.defaults[:chunk_size]).to_s }
|
182
182
|
end
|
183
183
|
|
184
184
|
# Check if an image exists.
|
data/lib/docker/version.rb
CHANGED
data/spec/docker/image_spec.rb
CHANGED
@@ -280,17 +280,6 @@ describe Docker::Image do
|
|
280
280
|
end
|
281
281
|
end
|
282
282
|
|
283
|
-
describe '#load' do
|
284
|
-
include_context "local paths"
|
285
|
-
let(:file) { File.join(project_dir, 'spec', 'fixtures', 'load.tar') }
|
286
|
-
context 'test image upload' do
|
287
|
-
it 'load tianon/true image' do
|
288
|
-
result = Docker::Image.load(file)
|
289
|
-
expect(result).to eq("")
|
290
|
-
end
|
291
|
-
end
|
292
|
-
end
|
293
|
-
|
294
283
|
describe '#refresh!' do
|
295
284
|
let(:image) { Docker::Image.create('fromImage' => 'debian:wheezy') }
|
296
285
|
|
@@ -312,6 +301,29 @@ describe Docker::Image do
|
|
312
301
|
end
|
313
302
|
end
|
314
303
|
|
304
|
+
describe '.load' do
|
305
|
+
include_context "local paths"
|
306
|
+
let(:file) { File.join(project_dir, 'spec', 'fixtures', 'load.tar') }
|
307
|
+
|
308
|
+
context 'when the argument is a String' do
|
309
|
+
it 'loads tianon/true image from the file system' do
|
310
|
+
result = Docker::Image.load(file)
|
311
|
+
expect(result).to eq("")
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
context 'when the argument is an IO' do
|
316
|
+
let(:io) { File.open(file) }
|
317
|
+
|
318
|
+
after { io.close }
|
319
|
+
|
320
|
+
it 'loads tinan/true image from the IO' do
|
321
|
+
result = Docker::Image.load(io)
|
322
|
+
expect(result).to eq("")
|
323
|
+
end
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
315
327
|
describe '.create' do
|
316
328
|
subject { described_class }
|
317
329
|
|
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.28.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-03-
|
11
|
+
date: 2016-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|