docker-api 1.34.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9b1247193395e3bff8d8813de77e6b2ec7462b5a
4
- data.tar.gz: d2eab94c0fc86823c3c2367bc2ac7fdcf9c439d1
2
+ SHA256:
3
+ metadata.gz: 7c8d229ece5b5b347a925c62c3f199a940393e58de0b02049aed295090739b04
4
+ data.tar.gz: 619467ed3697f6b9221f89bab145ba298bd47f5f26209e86df89347b6e83fe08
5
5
  SHA512:
6
- metadata.gz: da393c71a9de916af0748b925eb6643d4a716701de07fbcb27349cbf5d6dad1a19757a503b6d94168bc7e7839641b8a23a3d6d2784b12fc1a1b1a0a670b6e51d
7
- data.tar.gz: 593f911817f00d6c8ea3da3176549dad5a487c047c2608ddfe05297187c0db3876a88944ff7773cf364b3e39e9f1b4b67044031cf0b6447d44229a17b3e929a8
6
+ metadata.gz: 7a1a3a2a995c4a172217fc80eb573501502f7f05a337080bf4723d90bb2ba9053cde786aaa994993bd2841ebeeb18cc8a5e4dfa342792bb558fb84a3f4688b89
7
+ data.tar.gz: c9bbb7ae229ba1784859ddb0e3bc6e7df1651718d552779baac4e2ad49d34096aba760e6ce99fa41dfd14ef6ea0f3a5ddfc9178cf1c7c7f286a8385be1c59385
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) [![Dependency Status](https://gemnasium.com/swipely/docker-api.svg)](https://gemnasium.com/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 Remote API](https://docs.docker.com/reference/api/docker_remote_api/). Every method listed there is implemented. At the time of this writing, docker-api is meant to interface with Docker version 1.3.*
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/installation/#installation), and then run:
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](http://www.github.com/geemus/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.
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
 
@@ -413,7 +413,7 @@ container.read_file("/test")
413
413
 
414
414
  # Export a Container. Since an export is typically at least 300M, chunks of the
415
415
  # export are yielded instead of just returning the whole thing.
416
- File.open('export.tar', 'w') do |f|
416
+ File.open('export.tar', 'w') do |file|
417
417
  container.export { |chunk| file.write(chunk) }
418
418
  end
419
419
  # => nil
@@ -622,10 +622,6 @@ image 'repo:new_tag' => 'repo:tag' do
622
622
  end
623
623
  ```
624
624
 
625
- ## Known issues
626
-
627
- * If the docker daemon is always responding to your requests with a 400 Bad Request when using UNIX sockets, verify you're running Excon version 0.46.0 or greater. [Link](https://github.com/swipely/docker-api/issues/381)
628
-
629
625
  ## Not supported (yet)
630
626
 
631
627
  * Generating a tarball of images and metadata for a repository specified by a name: https://docs.docker.com/engine/reference/api/docker_remote_api_v1.14/#get-a-tarball-containing-all-images-and-tags-in-a-repository
@@ -80,7 +80,7 @@ private
80
80
  user_agent = "Swipely/Docker-API #{Docker::VERSION}"
81
81
  {
82
82
  :method => http_method,
83
- :path => "/v#{Docker::API_VERSION}#{path}",
83
+ :path => path,
84
84
  :query => query,
85
85
  :headers => { 'Content-Type' => content_type,
86
86
  'User-Agent' => user_agent,
@@ -189,10 +189,10 @@ 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
- excon_params = {response_block: Docker::Util.attach_for(block, msgs, tty)}
195
+ excon_params = {response_block: Docker::Util.attach_for(block, msgs, tty), idempotent: false}
196
196
 
197
197
  connection.get(path_for(:logs), opts, excon_params)
198
198
  msgs.messages.join
@@ -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/#{URI.encode(id)}/json", opts)
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
- block.call(new_event(b, r, t))
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/#{URI.encode(id)}/json", opts)
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] = URI.encode(name) }
177
+ Array(names).each { |name| query['names'.dup] = name }
178
178
  conn.get(
179
179
  '/images/get',
180
180
  query,
@@ -34,7 +34,7 @@ class Docker::Network
34
34
  end
35
35
 
36
36
  def reload
37
- network_json = @connection.get("/networks/#{URI.encode(@id)}")
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/#{URI.encode(id)}", opts)
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/#{URI.encode(id)}", opts)
65
+ conn.delete("/networks/#{id}", opts)
66
66
  nil
67
67
  end
68
68
  alias_method :delete, :remove
data/lib/docker/util.rb CHANGED
@@ -241,8 +241,9 @@ module Docker::Util
241
241
 
242
242
  def build_config_header(credentials)
243
243
  if credentials.is_a?(String)
244
- credentials = JSON.parse(credentials, symbolize_names: true)
244
+ credentials = MultiJson.load(credentials, symbolize_keys: true)
245
245
  end
246
+
246
247
  header = MultiJson.dump(
247
248
  credentials[:serveraddress].to_s => {
248
249
  'username' => credentials[:username].to_s,
@@ -1,7 +1,4 @@
1
1
  module Docker
2
2
  # The version of the docker-api gem.
3
- VERSION = '1.34.0'
4
-
5
- # The version of the compatible Docker remote API.
6
- API_VERSION = '1.16'
3
+ VERSION = '2.0.0'
7
4
  end
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!, :validate_version!, :ssl_options
135
+ :ping, :authenticate!, :ssl_options
147
136
  end
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.34.0
4
+ version: 2.0.0
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: 2017-11-05 00:00:00.000000000 Z
11
+ date: 2020-09-11 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
@@ -194,10 +194,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  - !ruby/object:Gem::Version
195
195
  version: '0'
196
196
  requirements: []
197
- rubyforge_project:
198
- rubygems_version: 2.4.6
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: []
203
- has_rdoc: