dockerapi 0.20.0.pre.rc6 → 0.20.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc2b5f6a477266a4b38267b70ba5a54981aa3dbc22c3fc81f864afbe9ae5d3b5
4
- data.tar.gz: e732c98e8001c6aaea4208e245c868cd2a3f88fba75e71b2a27f92287717a15c
3
+ metadata.gz: 71931122b06d9ba3d0234d6f053286e6397b420e76c8cc8d20b5fe0a37954a9c
4
+ data.tar.gz: b81f61be9510e0017c27dbadda88134da47bf92046e6c4b187f7be0d3eab5bb4
5
5
  SHA512:
6
- metadata.gz: fed5b955b62ad7370ab59e0b817fd1735b02eeba5ec52b4caedb507e290e73eeb1ad3ac38021b2c3c3ea3dc513dad44e8c6b66ca97ee6adafb2411d4b0f8c1a7
7
- data.tar.gz: 07e73166ce6f50fdc138ab5d72b14c45fc37a86dea120ea02f124d9aba6c87b288526438f1b2ee504b73ba6b768c462db34765498ca331cdf1bb103e02a14a9d
6
+ metadata.gz: 5a2b71b4b8ceffe3110d174a6104176c919fe1f2fca7bb1677bbc5b2e17300616cbcaf3a2ddeac984ca28852e88a8b17f9ff3a5b774b4c884e6c8059c4e1da08
7
+ data.tar.gz: 02af72c0856a6b7eaaae49e90e187f7aa99532accfb862b8d37b0ea65da3e09076509bd87ad9efc22f109853d44e557ecac0d6cdbc543dea0d4606ac0bce77a1
@@ -1,44 +1,34 @@
1
- # This workflow uses actions that are not certified by GitHub.
2
- # They are provided by a third-party and are governed by
3
- # separate terms of service, privacy policy, and support
4
- # documentation.
5
- # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
- # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
-
8
1
  name: CD
9
-
10
2
  on:
11
3
  push:
12
- branches: [ main ]
4
+ tags:
5
+ - 'v*.*.*'
13
6
 
14
7
  jobs:
15
8
  release:
16
9
  runs-on: ubuntu-latest
17
10
  env:
18
11
  GH_TOKEN: ${{ github.token }}
12
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEM_API}}"
19
13
  steps:
20
14
  - uses: actions/checkout@v3
21
15
  - name: Set up Ruby
22
- uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
16
+ uses: ruby/setup-ruby@v1
23
17
  with:
24
- ruby-version: 2.6
18
+ ruby-version: 3.3
25
19
  - name: Setup to RubyGems
26
20
  run: |
27
21
  mkdir -p $HOME/.gem
28
22
  touch $HOME/.gem/credentials
29
23
  chmod 0600 $HOME/.gem/credentials
30
24
  printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
31
- env:
32
- GEM_HOST_API_KEY: "${{secrets.RUBYGEM_API}}"
33
25
  - name: Install dependencies
34
26
  run: |
35
- gem update --system 3.2.3
27
+ gem update --system 3.5.11
36
28
  bundle install
37
29
  - name: Release
38
30
  run: |
39
31
  TAG=$(bundle exec rake version | tr -d '"')
40
- git tag $TAG
41
- git push --tags
42
32
  gh release create $TAG --generate-notes
43
33
  bundle exec rake build
44
34
  gem push pkg/*
@@ -1,65 +1,19 @@
1
- # This workflow uses actions that are not certified by GitHub.
2
- # They are provided by a third-party and are governed by
3
- # separate terms of service, privacy policy, and support
4
- # documentation.
5
- # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
- # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
-
8
1
  name: CI
9
-
10
2
  on:
11
3
  pull_request:
12
4
  branches: [ main ]
13
5
 
14
6
  jobs:
15
7
  test:
16
-
17
8
  runs-on: ubuntu-latest
18
9
 
19
10
  steps:
20
11
  - uses: actions/checkout@v2
21
12
  - name: Set up Ruby
22
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
23
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
24
- # uses: ruby/setup-ruby@v1
25
- uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
13
+ uses: ruby/setup-ruby@v1
26
14
  with:
27
- ruby-version: 2.6
28
- - name: Install Docker
29
- run: curl https://get.docker.com | sh
15
+ ruby-version: 3.3
30
16
  - name: Install dependencies
31
- run: |
32
- bin/setup
33
- sudo bin/setup
34
- - name: Test misc
35
- run: rspec spec/misc/*.rb
36
- - name: Test Image
37
- run: rspec spec/endpoints/image_spec.rb:1
38
- - name: Test Image authentication
39
- run: rspec spec/endpoints/image_spec.rb:196
40
- continue-on-error: true
41
- - name: Test Container
42
- run: rspec spec/endpoints/container_spec.rb
43
- - name: Test Volume
44
- run: rspec spec/endpoints/volume_spec.rb
45
- - name: Test Network
46
- run: rspec spec/endpoints/network_spec.rb
47
- - name: Test System
48
- run: rspec spec/endpoints/system_spec.rb
49
- - name: Test Exec
50
- run: rspec spec/endpoints/exec_spec.rb
51
- - name: Test Swarm
52
- run: rspec spec/endpoints/swarm_spec.rb
53
- - name: Test Node
54
- run: rspec spec/endpoints/node_spec.rb
55
- - name: Test Service
56
- run: rspec spec/endpoints/service_spec.rb
57
- - name: Test Task
58
- run: rspec spec/endpoints/task_spec.rb
59
- - name: Test Secret
60
- run: rspec spec/endpoints/secret_spec.rb
61
- - name: Test Config
62
- run: rspec spec/endpoints/config_spec.rb
63
- - name: Test Plugin
64
- run: rspec spec/endpoints/plugin_spec.rb
65
-
17
+ run: bundle install
18
+ - name: Run unit tests
19
+ run: rspec
data/Gemfile CHANGED
@@ -3,5 +3,5 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in dockerapi.gemspec
4
4
  gemspec
5
5
 
6
- gem "rake", "~> 12.0"
6
+ gem "rake", "~> 13.0"
7
7
  gem "rspec", "~> 3.0"
data/Gemfile.lock CHANGED
@@ -1,36 +1,39 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dockerapi (0.20.0.pre.rc6)
5
- excon (~> 0.79)
4
+ dockerapi (0.20.1)
5
+ base64
6
+ excon (>= 0.97, < 2)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
10
- diff-lcs (1.3)
11
- excon (0.79.0)
12
- rake (12.3.3)
13
- rspec (3.9.0)
14
- rspec-core (~> 3.9.0)
15
- rspec-expectations (~> 3.9.0)
16
- rspec-mocks (~> 3.9.0)
17
- rspec-core (3.9.2)
18
- rspec-support (~> 3.9.3)
19
- rspec-expectations (3.9.2)
11
+ base64 (0.2.0)
12
+ diff-lcs (1.5.1)
13
+ excon (1.1.1)
14
+ rake (13.2.1)
15
+ rspec (3.13.0)
16
+ rspec-core (~> 3.13.0)
17
+ rspec-expectations (~> 3.13.0)
18
+ rspec-mocks (~> 3.13.0)
19
+ rspec-core (3.13.2)
20
+ rspec-support (~> 3.13.0)
21
+ rspec-expectations (3.13.3)
20
22
  diff-lcs (>= 1.2.0, < 2.0)
21
- rspec-support (~> 3.9.0)
22
- rspec-mocks (3.9.1)
23
+ rspec-support (~> 3.13.0)
24
+ rspec-mocks (3.13.2)
23
25
  diff-lcs (>= 1.2.0, < 2.0)
24
- rspec-support (~> 3.9.0)
25
- rspec-support (3.9.3)
26
+ rspec-support (~> 3.13.0)
27
+ rspec-support (3.13.1)
26
28
 
27
29
  PLATFORMS
30
+ arm64-darwin-23
28
31
  ruby
29
32
 
30
33
  DEPENDENCIES
31
34
  dockerapi!
32
- rake (~> 12.0)
35
+ rake (~> 13.0)
33
36
  rspec (~> 3.0)
34
37
 
35
38
  BUNDLED WITH
36
- 2.4.16
39
+ 2.5.11
data/README.md CHANGED
@@ -143,6 +143,29 @@ container = Docker::API::Container.new
143
143
  # Create container
144
144
  container.create( {name: "nginx"}, {Image: "nginx:latest", HostConfig: {PortBindings: {"80/tcp": [ {HostIp: "0.0.0.0", HostPort: "80"} ]}}})
145
145
 
146
+ # A more complex container creation
147
+ container.create(
148
+ {name: "nginx"},
149
+ {
150
+ Image: "nginx:latest",
151
+ HostConfig: {
152
+ PortBindings: {
153
+ "80/tcp": [ {HostIp: "0.0.0.0", HostPort: "80"} ]
154
+ }
155
+ },
156
+ Env: ["DOCKER=nice", "DOCKERAPI=awesome"],
157
+ Cmd: ["echo", "hello from test"],
158
+ Entrypoint: ["sh"],
159
+ NetworkingConfig: {
160
+ EndpointsConfig: {
161
+ EndpointSettings: {
162
+ IPAddress: "192.172.0.100"
163
+ }
164
+ }
165
+ }
166
+ }
167
+ )
168
+
146
169
  # Start container
147
170
  container.start("nginx")
148
171
 
@@ -563,13 +586,14 @@ The default blocks can be found in `Docker::API::Base`.
563
586
 
564
587
  ## Development
565
588
 
566
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
589
+ Run `rake spec` to run the tests.
590
+
591
+ Run `bin/console` for an interactive prompt that will allow you to experiment.
567
592
 
568
593
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
569
594
 
570
595
  ### Release new version
571
596
 
572
- * Update CHANGELOG.
573
597
  * Update README as needed.
574
598
  * Update version.
575
599
  * Run tests.
data/dockerapi.gemspec CHANGED
@@ -10,11 +10,10 @@ Gem::Specification.new do |spec|
10
10
  spec.description = "Interact with Docker API directly from Ruby code. Comprehensive implementation (all available endpoints), no local Docker installation required, easily manipulated http responses."
11
11
  spec.homepage = "https://github.com/nu12/dockerapi"
12
12
  spec.license = "MIT"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+ spec.required_ruby_version = ">= 3.2"
14
14
 
15
15
  spec.metadata["homepage_uri"] = spec.homepage
16
16
  spec.metadata["source_code_uri"] = "https://github.com/nu12/dockerapi.git"
17
- spec.metadata["changelog_uri"] = "https://github.com/nu12/dockerapi/blob/master/CHANGELOG.md"
18
17
  spec.metadata["documentation_uri"] = "https://www.rubydoc.info/gems/dockerapi"
19
18
 
20
19
  # Specify which files should be added to the gem when it is released.
@@ -26,5 +25,6 @@ Gem::Specification.new do |spec|
26
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
26
  spec.require_paths = ["lib"]
28
27
 
29
- spec.add_dependency("excon", "~> 0.79")
28
+ spec.add_dependency("base64")
29
+ spec.add_dependency("excon", ">= 0.97", "< 2")
30
30
  end
@@ -18,7 +18,7 @@ class Docker::API::Base
18
18
  # Output to stdout.
19
19
  def default_streamer
20
20
  streamer = lambda do |chunk, remaining_bytes, total_bytes|
21
- p chunk.to_s.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?') if Docker::API::PRINT_TO_STDOUT
21
+ p chunk.to_s.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?') if Docker::API.print_to_stdout
22
22
  end
23
23
  streamer
24
24
  end
@@ -89,6 +89,7 @@ class Docker::API::Base
89
89
  # @param path [String]: Base URL string.
90
90
  # @param hash [Hash]: Hash object to be appended to the URL as query parameters.
91
91
  def build_path path, params = {}
92
+ path = "/v#{Docker::API::API_VERSION}#{path}"
92
93
  params.size > 0 ? [path, hash_to_params(params)].join("?") : path
93
94
  end
94
95
 
@@ -24,7 +24,7 @@ class Docker::API::Config < Docker::API::Base
24
24
  #
25
25
  # @param body [Hash]: Request body to be sent as json.
26
26
  def create body = {}
27
- @connection.request(method: :post, path: "/configs/create", headers: {"Content-Type": "application/json"}, body: body.to_json)
27
+ @connection.request(method: :post, path: "/v#{Docker::API::API_VERSION}/configs/create", headers: {"Content-Type": "application/json"}, body: body.to_json)
28
28
  end
29
29
 
30
30
  # Inspect a config
@@ -35,7 +35,7 @@ class Docker::API::Config < Docker::API::Base
35
35
  #
36
36
  # @param name [String]: The ID or name of the config.
37
37
  def details name
38
- @connection.get("/configs/#{name}")
38
+ @connection.get("/v#{Docker::API::API_VERSION}/configs/#{name}")
39
39
  end
40
40
 
41
41
  # Update a config
@@ -50,7 +50,7 @@ class Docker::API::Config < Docker::API::Base
50
50
  #
51
51
  # @param body [Hash]: Request body to be sent as json.
52
52
  def update name, params = {}, body = {}
53
- @connection.request(method: :post, path: build_path("/configs/#{name}/update",params), headers: {"Content-Type": "application/json"}, body: body.to_json)
53
+ @connection.request(method: :post, path: build_path("/v#{Docker::API::API_VERSION}/configs/#{name}/update",params), headers: {"Content-Type": "application/json"}, body: body.to_json)
54
54
  end
55
55
 
56
56
  # Delete a config
@@ -61,6 +61,6 @@ class Docker::API::Config < Docker::API::Base
61
61
  #
62
62
  # @param name [String]: The ID or name of the config.
63
63
  def delete name
64
- @connection.delete("/configs/#{name}")
64
+ @connection.delete("/v#{Docker::API::API_VERSION}/configs/#{name}")
65
65
  end
66
66
  end
@@ -11,7 +11,8 @@ class Docker::API::Connection
11
11
  # @param params [Hash]: Request parameters.
12
12
  def request params
13
13
  response = Docker::API::Response.new(@connection.request(params).data)
14
- p response if Docker::API::PRINT_RESPONSE_TO_STDOUT
14
+ response.request_params = params
15
+ p response if Docker::API.print_response_to_stdout
15
16
  response
16
17
  end
17
18
 
@@ -20,9 +21,9 @@ class Docker::API::Connection
20
21
  #
21
22
  # @param url [String]: URL for the connection.
22
23
  # @param params [String]: Additional parameters.
23
- def initialize url = nil, params = nil
24
- return @connection = Excon.new('unix:///', {socket: '/var/run/docker.sock'}) unless url
25
- @connection = Excon.new(url, params || {})
24
+ def initialize url = nil, params = {}
25
+ return @connection = Excon.new('unix:///', params.merge({socket: '/var/run/docker.sock'})) unless url
26
+ @connection = Excon.new(url, params)
26
27
  end
27
28
 
28
29
  end
@@ -46,7 +46,7 @@ class Docker::API::Container < Docker::API::Base
46
46
  #
47
47
  # @param name [String]: The ID or name of the container.
48
48
  def changes name
49
- @connection.get("/containers/#{name}/changes")
49
+ @connection.get(build_path("/containers/#{name}/changes"))
50
50
  end
51
51
 
52
52
  ##
@@ -118,7 +118,8 @@ class Docker::API::Container < Docker::API::Base
118
118
  # @param name [String]: The ID or name of the container.
119
119
  # @param body [Hash]: Request body to be sent as json.
120
120
  def update name, body = {}
121
- @connection.request(method: :post, path: "/containers/#{name}/update", headers: {"Content-Type": "application/json"}, body: body.to_json)
121
+
122
+ @connection.request(method: :post, path: build_path("/containers/#{name}/update"), headers: {"Content-Type": "application/json"}, body: body.to_json)
122
123
  end
123
124
 
124
125
  ##
@@ -164,7 +165,7 @@ class Docker::API::Container < Docker::API::Base
164
165
  #
165
166
  # @param name [String]: The ID or name of the container.
166
167
  def pause name
167
- @connection.post("/containers/#{name}/pause")
168
+ @connection.post(build_path("/containers/#{name}/pause"))
168
169
  end
169
170
 
170
171
  ##
@@ -175,7 +176,7 @@ class Docker::API::Container < Docker::API::Base
175
176
  #
176
177
  # @param name [String]: The ID or name of the container.
177
178
  def unpause name
178
- @connection.post("/containers/#{name}/unpause")
179
+ @connection.post(build_path("/containers/#{name}/unpause"))
179
180
  end
180
181
 
181
182
  ##
@@ -12,7 +12,7 @@ class Docker::API::Exec < Docker::API::Base
12
12
  # @param name [String]: The ID or name of the container.
13
13
  # @param body [Hash]: Request body to be sent as json.
14
14
  def create name, body = {}
15
- @connection.request(method: :post, path: "/containers/#{name}/exec", headers: {"Content-Type": "application/json"}, body: body.to_json )
15
+ @connection.request(method: :post, path: build_path("/containers/#{name}/exec"), headers: {"Content-Type": "application/json"}, body: body.to_json )
16
16
  end
17
17
 
18
18
  ##
@@ -25,7 +25,7 @@ class Docker::API::Exec < Docker::API::Base
25
25
  # @param body [Hash]: Request body to be sent as json.
26
26
  # @param &block: Replace the default output to stdout behavior.
27
27
  def start name, body = {}, &block
28
- @connection.request(method: :post, path: "/exec/#{name}/start", headers: {"Content-Type": "application/json"}, body: body.to_json,
28
+ @connection.request(method: :post, path: build_path("/exec/#{name}/start"), headers: {"Content-Type": "application/json"}, body: body.to_json,
29
29
  response_block: block_given? ? block : default_streamer )
30
30
  end
31
31
 
@@ -49,7 +49,7 @@ class Docker::API::Exec < Docker::API::Base
49
49
  #
50
50
  # @param name [String]: Exec instance ID.
51
51
  def details name
52
- @connection.get("/exec/#{name}/json")
52
+ @connection.get(build_path("/exec/#{name}/json"))
53
53
  end
54
54
 
55
55
  end
@@ -11,7 +11,7 @@ class Docker::API::Image < Docker::API::Base
11
11
  #
12
12
  # @param name [String]: The ID or name of the image.
13
13
  def details name
14
- @connection.get("/images/#{name}/json")
14
+ @connection.get(build_path("/images/#{name}/json"))
15
15
  end
16
16
 
17
17
  ##
@@ -23,7 +23,7 @@ class Docker::API::Image < Docker::API::Base
23
23
  # @param name [String]: The ID or name of the image.
24
24
  # @param authentication [Hash]: Authentication parameters.
25
25
  def distribution name, authentication = {}
26
- request = {method: :get, path: "/distribution/#{name}/json"}
26
+ request = {method: :get, path: build_path("/distribution/#{name}/json")}
27
27
  request[:headers] = {"X-Registry-Auth" => auth_encoder(authentication)} if authentication.any?
28
28
  @connection.request(request)
29
29
  end
@@ -36,7 +36,7 @@ class Docker::API::Image < Docker::API::Base
36
36
  #
37
37
  # @param name [String]: The ID or name of the image.
38
38
  def history name
39
- @connection.get("/images/#{name}/history")
39
+ @connection.get(build_path("/images/#{name}/history"))
40
40
  end
41
41
 
42
42
  ##
@@ -146,7 +146,7 @@ class Docker::API::Image < Docker::API::Base
146
146
  # @param params [Hash]: Parameters that are appended to the URL.
147
147
  # @param body [Hash]: Request body to be sent as json.
148
148
  def commit params = {}, body = {}
149
- container = Docker::API::Container.new.details(params[:container])
149
+ container = Docker::API::Container.new(@connection).details(params[:container])
150
150
  return container if [404, 301].include? container.status
151
151
  @connection.request(method: :post, path: build_path("/commit", params), headers: {"Content-Type": "application/json"}, body: container.json["Config"].merge(body).to_json)
152
152
  end
@@ -185,7 +185,7 @@ class Docker::API::Image < Docker::API::Base
185
185
  def build path, params = {}, authentication = {}, &block
186
186
  raise Docker::API::Error.new("Expected path or params[:remote]") unless path || params[:remote]
187
187
 
188
- headers = {"Content-type": "application/x-tar"}
188
+ headers = {"Content-type" => "application/x-tar"}
189
189
  headers.merge!({"X-Registry-Config": auth_encoder(authentication) }) if authentication.any?
190
190
 
191
191
  if path == nil and params.has_key? :remote
@@ -34,7 +34,7 @@ class Docker::API::Network < Docker::API::Base
34
34
  #
35
35
  # @param body [Hash]: Request body to be sent as json.
36
36
  def create body = {}
37
- @connection.request(method: :post, path: "/networks/create", headers: {"Content-Type": "application/json"}, body: body.to_json)
37
+ @connection.request(method: :post, path: build_path("/networks/create"), headers: {"Content-Type" => "application/json"}, body: body.to_json)
38
38
  end
39
39
 
40
40
  ##
@@ -45,7 +45,7 @@ class Docker::API::Network < Docker::API::Base
45
45
  #
46
46
  # @param name [String]: The ID or name of the network.
47
47
  def remove name
48
- @connection.delete("/networks/#{name}")
48
+ @connection.delete(build_path("/networks/#{name}"))
49
49
  end
50
50
 
51
51
  ##
@@ -68,7 +68,7 @@ class Docker::API::Network < Docker::API::Base
68
68
  # @param name [String]: The ID or name of the network.
69
69
  # @param body [Hash]: Request body to be sent as json.
70
70
  def connect name, body = {}
71
- @connection.request(method: :post, path: "/networks/#{name}/connect", headers: {"Content-Type": "application/json"}, body: body.to_json)
71
+ @connection.request(method: :post, path: build_path("/networks/#{name}/connect"), headers: {"Content-Type" => "application/json"}, body: body.to_json)
72
72
  end
73
73
 
74
74
  ##
@@ -80,7 +80,7 @@ class Docker::API::Network < Docker::API::Base
80
80
  # @param name [String]: The ID or name of the network.
81
81
  # @param body [Hash]: Request body to be sent as json.
82
82
  def disconnect name, body = {}
83
- @connection.request(method: :post, path: "/networks/#{name}/disconnect", headers: {"Content-Type": "application/json"}, body: body.to_json)
83
+ @connection.request(method: :post, path: build_path("/networks/#{name}/disconnect"), headers: {"Content-Type" => "application/json"}, body: body.to_json)
84
84
  end
85
85
 
86
86
  end
@@ -25,7 +25,7 @@ class Docker::API::Node < Docker::API::Base
25
25
  # @param params [Hash]: Parameters that are appended to the URL.
26
26
  # @param body [Hash]: Request body to be sent as json.
27
27
  def update name, params = {}, body = {}
28
- @connection.request(method: :post, path: build_path("nodes/#{name}/update", params), headers: {"Content-Type": "application/json"}, body: body.to_json)
28
+ @connection.request(method: :post, path: build_path("/nodes/#{name}/update", params), headers: {"Content-Type" => "application/json"}, body: body.to_json)
29
29
  end
30
30
 
31
31
  ##
@@ -48,6 +48,6 @@ class Docker::API::Node < Docker::API::Base
48
48
  #
49
49
  # @param name [String]: The ID or name of the node.
50
50
  def details name
51
- @connection.get("/nodes/#{name}")
51
+ @connection.get(build_path("/nodes/#{name}"))
52
52
  end
53
53
  end
@@ -39,7 +39,7 @@ class Docker::API::Plugin < Docker::API::Base
39
39
  #
40
40
  # @param authentication [Hash]: Authentication parameters.
41
41
  def install params = {}, privileges = [], authentication = {}
42
- headers = {"Content-Type": "application/json"}
42
+ headers = {"Content-Type" => "application/json"}
43
43
  headers.merge!({"X-Registry-Auth" => Base64.urlsafe_encode64(authentication.to_json.to_s)}) if authentication.keys.size > 0
44
44
  @connection.request(method: :post, path: build_path("/plugins/pull", params), headers: headers, body: privileges.to_json )
45
45
  end
@@ -52,7 +52,7 @@ class Docker::API::Plugin < Docker::API::Base
52
52
  #
53
53
  # @param name [String]: The ID or name of the plugin.
54
54
  def details name
55
- @connection.get("/plugins/#{name}/json")
55
+ @connection.get(build_path("/plugins/#{name}/json"))
56
56
  end
57
57
 
58
58
  # Remove a plugin
@@ -89,7 +89,7 @@ class Docker::API::Plugin < Docker::API::Base
89
89
  #
90
90
  # @param name [String]: The ID or name of the plugin.
91
91
  def disable name
92
- @connection.post("/plugins/#{name}/disable")
92
+ @connection.post(build_path("/plugins/#{name}/disable"))
93
93
  end
94
94
 
95
95
  # Upgrade a plugin
@@ -106,7 +106,7 @@ class Docker::API::Plugin < Docker::API::Base
106
106
  #
107
107
  # @param authentication [Hash]: Authentication parameters.
108
108
  def upgrade name, params = {}, privileges = [], authentication = {}
109
- headers = {"Content-Type": "application/json"}
109
+ headers = {"Content-Type" => "application/json"}
110
110
  headers.merge!({"X-Registry-Auth" => Base64.urlsafe_encode64(authentication.to_json.to_s)}) if authentication.keys.size > 0
111
111
  @connection.request(method: :post, path: build_path("/plugins/#{name}/upgrade", params), headers: headers, body: privileges.to_json )
112
112
  end
@@ -122,7 +122,7 @@ class Docker::API::Plugin < Docker::API::Base
122
122
  # @param path [String]: Path to tar file that contains rootfs folder and config.json file.
123
123
  def create name, path
124
124
  file = File.open( File.expand_path( path ) , "r")
125
- response = @connection.request(method: :post, path: "/plugins/create?name=#{name}", body: file.read.to_s )
125
+ response = @connection.request(method: :post, path: build_path("/plugins/create?name=#{name}"), body: file.read.to_s )
126
126
  file.close
127
127
  response
128
128
  end
@@ -138,9 +138,9 @@ class Docker::API::Plugin < Docker::API::Base
138
138
  # @param authentication [Hash]: Authentication parameters.
139
139
  def push name, authentication = {}
140
140
  if authentication.keys.size > 0
141
- @connection.request(method: :post, path: "/plugins/#{name}/push", headers: {"X-Registry-Auth" => Base64.urlsafe_encode64(authentication.to_json.to_s)})
141
+ @connection.request(method: :post, path: build_path("/plugins/#{name}/push"), headers: {"X-Registry-Auth" => Base64.urlsafe_encode64(authentication.to_json.to_s)})
142
142
  else
143
- @connection.post("/plugins/#{name}/push")
143
+ @connection.post(build_path("/plugins/#{name}/push"))
144
144
  end
145
145
  end
146
146
 
@@ -154,7 +154,7 @@ class Docker::API::Plugin < Docker::API::Base
154
154
  #
155
155
  # @param config [Array]: Plugin configuration to be sent as json in request body.
156
156
  def configure name, config
157
- @connection.request(method: :post, path: "/plugins/#{name}/set", headers: {"Content-Type": "application/json"}, body:config.to_json)
157
+ @connection.request(method: :post, path: build_path("/plugins/#{name}/set"), headers: {"Content-Type" => "application/json"}, body:config.to_json)
158
158
  end
159
159
 
160
160
  end
@@ -2,6 +2,7 @@
2
2
  # Reponse class.
3
3
  class Docker::API::Response < Excon::Response
4
4
  attr_reader(:json, :path)
5
+ attr_accessor(:request_params)
5
6
 
6
7
  ##
7
8
  # Initialize a new Response object.
@@ -21,7 +21,7 @@ class Docker::API::Secret < Docker::API::Base
21
21
  #
22
22
  # @param body [Hash]: Request body to be sent as json.
23
23
  def create body = {}
24
- @connection.request(method: :post, path: "/secrets/create", headers: {"Content-Type": "application/json"}, body: body.to_json)
24
+ @connection.request(method: :post, path: build_path("/secrets/create"), headers: {"Content-Type" => "application/json"}, body: body.to_json)
25
25
  end
26
26
 
27
27
  # Inspect a secret
@@ -31,7 +31,7 @@ class Docker::API::Secret < Docker::API::Base
31
31
  #
32
32
  # @param name [String]: The ID or name of the secret.
33
33
  def details name
34
- @connection.get("/secrets/#{name}")
34
+ @connection.get(build_path("/secrets/#{name}"))
35
35
  end
36
36
 
37
37
  # Update a secret
@@ -43,7 +43,7 @@ class Docker::API::Secret < Docker::API::Base
43
43
  # @param params [Hash]: Parameters that are appended to the URL.
44
44
  # @param body [Hash]: Request body to be sent as json.
45
45
  def update name, params = {}, body = {}
46
- @connection.request(method: :post, path: build_path("/secrets/#{name}/update",params), headers: {"Content-Type": "application/json"}, body: body.to_json)
46
+ @connection.request(method: :post, path: build_path("/secrets/#{name}/update",params), headers: {"Content-Type" => "application/json"}, body: body.to_json)
47
47
  end
48
48
 
49
49
  # Delete a secret
@@ -53,6 +53,6 @@ class Docker::API::Secret < Docker::API::Base
53
53
  #
54
54
  # @param name [String]: The ID or name of the secret.
55
55
  def delete name
56
- @connection.delete("/secrets/#{name}")
56
+ @connection.delete(build_path("/secrets/#{name}"))
57
57
  end
58
58
  end
@@ -22,9 +22,9 @@ class Docker::API::Service < Docker::API::Base
22
22
  # @param body [Hash]: Request body to be sent as json.
23
23
  # @param authentication [Hash]: Authentication parameters.
24
24
  def create body = {}, authentication = {}
25
- headers = {"Content-Type": "application/json"}
25
+ headers = {"Content-Type" => "application/json"}
26
26
  headers.merge!({"X-Registry-Auth" => auth_encoder(authentication) }) if authentication.keys.size > 0
27
- @connection.request(method: :post, path: "/services/create", headers: headers, body: body.to_json)
27
+ @connection.request(method: :post, path: build_path("/services/create"), headers: headers, body: body.to_json)
28
28
  end
29
29
 
30
30
  # Update a service
@@ -38,7 +38,7 @@ class Docker::API::Service < Docker::API::Base
38
38
  # @param authentication [Hash]: Authentication parameters.
39
39
  def update name, params = {}, body = {}, authentication = {}
40
40
  # view https://github.com/docker/swarmkit/issues/1394#issuecomment-240850719
41
- headers = {"Content-Type": "application/json"}
41
+ headers = {"Content-Type" => "application/json"}
42
42
  headers.merge!({"X-Registry-Auth" => auth_encoder(authentication) }) if authentication.keys.size > 0
43
43
  @connection.request(method: :post, path: build_path("/services/#{name}/update", params), headers: headers, body: body.to_json)
44
44
  end
@@ -72,6 +72,6 @@ class Docker::API::Service < Docker::API::Base
72
72
  #
73
73
  # @param name [String]: The ID or name of the service.
74
74
  def delete name
75
- @connection.delete("/services/#{name}")
75
+ @connection.delete(build_path("/services/#{name}"))
76
76
  end
77
77
  end
@@ -11,7 +11,7 @@ class Docker::API::Swarm < Docker::API::Base
11
11
  #
12
12
  # @param body [Hash]: Request body to be sent as json.
13
13
  def init body = {}
14
- @connection.request(method: :post, path: build_path("/swarm/init"), headers: {"Content-Type": "application/json"}, body: body.to_json)
14
+ @connection.request(method: :post, path: build_path("/swarm/init"), headers: {"Content-Type" => "application/json"}, body: body.to_json)
15
15
  end
16
16
 
17
17
  ##
@@ -23,7 +23,7 @@ class Docker::API::Swarm < Docker::API::Base
23
23
  # @param params [Hash]: Parameters that are appended to the URL.
24
24
  # @param body [Hash]: Request body to be sent as json.
25
25
  def update params = {}, body = {}
26
- @connection.request(method: :post, path: build_path("/swarm/update", params), headers: {"Content-Type": "application/json"}, body: body.to_json)
26
+ @connection.request(method: :post, path: build_path("/swarm/update", params), headers: {"Content-Type" => "application/json"}, body: body.to_json)
27
27
  end
28
28
 
29
29
  ##
@@ -32,7 +32,7 @@ class Docker::API::Swarm < Docker::API::Base
32
32
  # Docker API: GET /swarm
33
33
  # @see https://docs.docker.com/engine/api/v1.40/#operation/SwarmInspect
34
34
  def details
35
- @connection.get("/swarm")
35
+ @connection.get(build_path("/swarm"))
36
36
  end
37
37
 
38
38
  ##
@@ -41,7 +41,7 @@ class Docker::API::Swarm < Docker::API::Base
41
41
  # Docker API: GET /swarm/unlockkey
42
42
  # @see https://docs.docker.com/engine/api/v1.40/#operation/SwarmUnlockkey
43
43
  def unlock_key
44
- @connection.get("/swarm/unlockkey")
44
+ @connection.get(build_path("/swarm/unlockkey"))
45
45
  end
46
46
 
47
47
  ##
@@ -52,7 +52,7 @@ class Docker::API::Swarm < Docker::API::Base
52
52
  #
53
53
  # @param body [Hash]: Request body to be sent as json.
54
54
  def unlock body = {}
55
- @connection.request(method: :post, path: "/swarm/unlock", headers: {"Content-Type": "application/json"}, body: body.to_json)
55
+ @connection.request(method: :post, path: build_path("/swarm/unlock"), headers: {"Content-Type" => "application/json"}, body: body.to_json)
56
56
  end
57
57
 
58
58
  ##
@@ -63,7 +63,7 @@ class Docker::API::Swarm < Docker::API::Base
63
63
  #
64
64
  # @param body [Hash]: Request body to be sent as json.
65
65
  def join body = {}
66
- @connection.request(method: :post, path: "/swarm/join", headers: {"Content-Type": "application/json"}, body: body.to_json)
66
+ @connection.request(method: :post, path: build_path("/swarm/join"), headers: {"Content-Type" => "application/json"}, body: body.to_json)
67
67
  end
68
68
 
69
69
  ##
@@ -11,7 +11,7 @@ class Docker::API::System < Docker::API::Base
11
11
  #
12
12
  # @param body [Hash]: Request body to be sent as json.
13
13
  def auth body = {}
14
- @connection.request(method: :post, path: "/auth", headers: { "Content-Type" => "application/json" }, body: body.to_json)
14
+ @connection.request(method: :post, path: build_path("/auth"), headers: { "Content-Type" => "application/json" }, body: body.to_json)
15
15
  end
16
16
 
17
17
  ##
@@ -32,7 +32,7 @@ class Docker::API::System < Docker::API::Base
32
32
  # Docker API: GET /_ping
33
33
  # @see https://docs.docker.com/engine/api/v1.40/#operation/SystemPing
34
34
  def ping
35
- @connection.get("/_ping")
35
+ @connection.get(build_path("/_ping"))
36
36
  end
37
37
 
38
38
  ##
@@ -41,7 +41,7 @@ class Docker::API::System < Docker::API::Base
41
41
  # Docker API: GET /info
42
42
  # @see https://docs.docker.com/engine/api/v1.40/#operation/SystemInfo
43
43
  def info
44
- @connection.get("/info")
44
+ @connection.get(build_path("/info"))
45
45
  end
46
46
 
47
47
  ##
@@ -50,7 +50,7 @@ class Docker::API::System < Docker::API::Base
50
50
  # Docker API: GET /version
51
51
  # @see https://docs.docker.com/engine/api/v1.40/#operation/SystemVersion
52
52
  def version
53
- @connection.get("/version")
53
+ @connection.get(build_path("/version"))
54
54
  end
55
55
 
56
56
  ##
@@ -21,7 +21,7 @@ class Docker::API::Task < Docker::API::Base
21
21
  #
22
22
  # @param name [String]: The ID or name of the task.
23
23
  def details name
24
- @connection.get("/tasks/#{name}")
24
+ @connection.get(build_path("/tasks/#{name}"))
25
25
  end
26
26
 
27
27
  # Get stdout and stderr logs from a task.
@@ -1,6 +1,6 @@
1
1
  module Docker
2
2
  module API
3
- GEM_VERSION = "0.20.0-rc6"
3
+ GEM_VERSION = "0.20.1"
4
4
 
5
5
  API_VERSION = "1.43"
6
6
 
@@ -22,7 +22,7 @@ class Docker::API::Volume < Docker::API::Base
22
22
  #
23
23
  # @param name [String]: The ID or name of the volume.
24
24
  def details name
25
- @connection.get("/volumes/#{name}")
25
+ @connection.get(build_path("/volumes/#{name}"))
26
26
  end
27
27
 
28
28
  ##
@@ -33,7 +33,7 @@ class Docker::API::Volume < Docker::API::Base
33
33
  #
34
34
  # @param body [Hash]: Request body to be sent as json.
35
35
  def create body = {}
36
- @connection.request(method: :post, path: "/volumes/create", headers: {"Content-Type": "application/json"}, body: body.to_json)
36
+ @connection.request(method: :post, path: build_path("/volumes/create"), headers: {"Content-Type" => "application/json"}, body: body.to_json)
37
37
  end
38
38
 
39
39
  ##
data/lib/dockerapi.rb CHANGED
@@ -27,11 +27,23 @@ module Docker
27
27
 
28
28
  ##
29
29
  # This variable controls output verbosity.
30
- PRINT_TO_STDOUT = true
30
+ def self.print_to_stdout
31
+ @@print_to_stdout
32
+ end
33
+ def self.print_to_stdout=(bool)
34
+ @@print_to_stdout = bool
35
+ end
36
+ self.print_to_stdout = true
31
37
 
32
38
  ##
33
39
  # This variable controls output verbosity.
34
- PRINT_RESPONSE_TO_STDOUT = false
40
+ def self.print_response_to_stdout
41
+ @@print_response_to_stdout
42
+ end
43
+ def self.print_response_to_stdout=(bool)
44
+ @@print_response_to_stdout = bool
45
+ end
46
+ self.print_response_to_stdout = false
35
47
 
36
48
  ##
37
49
  # Valid values for parameter validations.
data/mise.toml ADDED
@@ -0,0 +1,2 @@
1
+ [tools]
2
+ ruby = "3.2"
metadata CHANGED
@@ -1,29 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockerapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0.pre.rc6
4
+ version: 0.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alysson A. Costa
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-12 00:00:00.000000000 Z
11
+ date: 2025-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: excon
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - "~>"
31
+ - - ">="
18
32
  - !ruby/object:Gem::Version
19
- version: '0.79'
33
+ version: '0.97'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '2'
20
37
  type: :runtime
21
38
  prerelease: false
22
39
  version_requirements: !ruby/object:Gem::Requirement
23
40
  requirements:
24
- - - "~>"
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0.97'
44
+ - - "<"
25
45
  - !ruby/object:Gem::Version
26
- version: '0.79'
46
+ version: '2'
27
47
  description: Interact with Docker API directly from Ruby code. Comprehensive implementation
28
48
  (all available endpoints), no local Docker installation required, easily manipulated
29
49
  http responses.
@@ -37,14 +57,12 @@ files:
37
57
  - ".github/workflows/ci.yml"
38
58
  - ".gitignore"
39
59
  - ".rspec"
40
- - CHANGELOG.md
41
60
  - Gemfile
42
61
  - Gemfile.lock
43
62
  - LICENSE.txt
44
63
  - README.md
45
64
  - Rakefile
46
65
  - bin/console
47
- - bin/setup
48
66
  - dockerapi.gemspec
49
67
  - lib/docker/api/base.rb
50
68
  - lib/docker/api/config.rb
@@ -65,15 +83,15 @@ files:
65
83
  - lib/docker/api/version.rb
66
84
  - lib/docker/api/volume.rb
67
85
  - lib/dockerapi.rb
86
+ - mise.toml
68
87
  homepage: https://github.com/nu12/dockerapi
69
88
  licenses:
70
89
  - MIT
71
90
  metadata:
72
91
  homepage_uri: https://github.com/nu12/dockerapi
73
92
  source_code_uri: https://github.com/nu12/dockerapi.git
74
- changelog_uri: https://github.com/nu12/dockerapi/blob/master/CHANGELOG.md
75
93
  documentation_uri: https://www.rubydoc.info/gems/dockerapi
76
- post_install_message:
94
+ post_install_message:
77
95
  rdoc_options: []
78
96
  require_paths:
79
97
  - lib
@@ -81,15 +99,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
99
  requirements:
82
100
  - - ">="
83
101
  - !ruby/object:Gem::Version
84
- version: 2.3.0
102
+ version: '3.2'
85
103
  required_rubygems_version: !ruby/object:Gem::Requirement
86
104
  requirements:
87
- - - ">"
105
+ - - ">="
88
106
  - !ruby/object:Gem::Version
89
- version: 1.3.1
107
+ version: '0'
90
108
  requirements: []
91
- rubygems_version: 3.2.3
92
- signing_key:
109
+ rubygems_version: 3.5.11
110
+ signing_key:
93
111
  specification_version: 4
94
112
  summary: Interact with Docker API from Ruby code.
95
113
  test_files: []
data/CHANGELOG.md DELETED
@@ -1,234 +0,0 @@
1
- # 0.18.0
2
-
3
- Method `Docker::API::Image#distribution` now accepts authentication parameters. Feature introduced in [PR#3](https://github.com/nu12/dockerapi/pull/3)
4
-
5
- Contributors: @zarqman
6
-
7
- # 0.17.0
8
-
9
- New block execution introduced in [PR#1](https://github.com/nu12/dockerapi/pull/1).
10
-
11
- Contributors: @zarqman
12
-
13
- # 0.16.0
14
-
15
- `Docker::API::Task#logs` method can now receive a block to replace standard output to stdout behavior.
16
-
17
- Add `auth_encoder` to provide standard implementation for the authentication header where needed.
18
-
19
- # 0.15.0
20
-
21
- `Docker::API::System#events` and `Docker::API::Exec#start` methods can now receive a block to replace standard output to stdout behavior.
22
-
23
- General refactoring and API documentation.
24
-
25
- # 0.14.0
26
-
27
- Method `Docker::API::Container#archive` is splitted in `#get_archive` and `#put_archive` as per Docker API documentation.
28
-
29
- The following `Docker::API::Container` methods that can now receive a block:
30
- * logs (output to stdout)
31
- * attach (output to stdout)
32
- * stats (output to stdout)
33
- * export (write file)
34
- * get_archive (write file)
35
-
36
- # 0.13.0
37
-
38
- Add default behavior for file read, write and output to stdout. Whenever a method can receive a block, this default behavior can be replaced.
39
-
40
- The following `Docker::API::Image` methods that can now receive a block:
41
- * export (write file)
42
- * create (output to stdout)
43
- * build (output to stdout)
44
-
45
- Default output to stdout can be supressed by setting `Docker::API::PRINT_TO_STDOUT` to `false`
46
-
47
- Method parameters `params` and `body` will be automatically evaluated whenever they are present in the method's signature.
48
-
49
- # 0.12.0
50
-
51
- Add `Docker::API::Plugin` methods:
52
- * list
53
- * privileges
54
- * install
55
- * details
56
- * remove
57
- * enable
58
- * disable
59
- * upgrade
60
- * create
61
- * push
62
- * configure
63
-
64
- # 0.11.0
65
-
66
- Add `Docker::API::Task` methods:
67
- * list
68
- * details
69
- * logs
70
-
71
- Add `Docker::API::Secret` methods:
72
- * create
73
- * update
74
- * list
75
- * details
76
- * delete
77
-
78
- Add `Docker::API::Config` methods:
79
- * create
80
- * update
81
- * list
82
- * details
83
- * delete
84
-
85
- Add `Docker::API::Image` methods:
86
- * distribution
87
-
88
- # 0.10.0
89
-
90
- Add `Docker::API::Service` methods:
91
- * create
92
- * update
93
- * list
94
- * details
95
- * logs
96
- * delete
97
-
98
- # 0.9.0
99
-
100
- Significant change: `#inspect` is now deprecated and replaced by `#details` in the following classes:
101
- * `Docker::API::Container`
102
- * `Docker::API::Image`
103
- * `Docker::API::Network`
104
- * `Docker::API::Volume`
105
- * `Docker::API::Exec`
106
- * `Docker::API::Swarm`
107
- * `Docker::API::Node`
108
-
109
- The method will be removed in the refactoring phase.
110
-
111
- # 0.8.1
112
-
113
- Restore the default `#inspect` output for `Docker::API` classes.
114
-
115
- Most of the overriding methods take an argument, therefore calling using the expect arguments will return a `Docker::API::Response` object, while calling without arguments will return `Kernel#inspect`. To avoid this confusing schema, next release will rename `#inspect` within `Docker::API` to something else.
116
-
117
- # 0.8.0
118
-
119
- Add `Docker::API::Swarm` methods:
120
- * init
121
- * update
122
- * ~~inspect~~ details
123
- * unlock_key
124
- * unlock
125
- * join
126
- * leave
127
-
128
- Add `Docker::API::Node` methods:
129
- * list
130
- * ~~inspect~~ details
131
- * update
132
- * delete
133
-
134
- Query parameters and request body json can now skip the validation step with `:skip_validation => true` option.
135
-
136
- # 0.7.0
137
-
138
- Significant changes: `Docker::API::Connection` is now a regular class intead of a Singleton, allowing multiple connections to be stablished within the same program (replacing the connect_to implementation). To leverage this feature, API-related classes must be initialized and may or may not receive a `Docker::API::Connection` as parameter, or it'll connect to `/var/run/docker.sock` by default. For this reason, class methods were replaced with instance methods. Documentation will reflect this changes of implementation.
139
-
140
- Bug fix: Image push returns a 20X status even when the push is unsucessful. To prevent false positives, it now requires the authentication parameters to be provided, generating a 403 status for invalid credentials or an error if they are absent.
141
-
142
- # 0.6.0
143
-
144
- Add connection parameters specifications with connect_to in Docker::API::Connection.
145
-
146
- Add `Docker::API::Exec` methods:
147
- * create
148
- * start
149
- * resize
150
- * ~~inspect~~ details
151
-
152
- # 0.5.0
153
-
154
- Add `Docker::API::System` methods:
155
- * auth
156
- * ping
157
- * info
158
- * version
159
- * events
160
- * df
161
-
162
- Add new response class `Docker::API::Response` with the following methods:
163
- * json
164
- * path
165
- * success?
166
-
167
- Error classes output better error messages.
168
-
169
- # 0.4.0
170
-
171
- Add `Docker::API::Network` methods:
172
- * list
173
- * ~~inspect~~ details
174
- * create
175
- * remove
176
- * prune
177
- * connect
178
- * disconnect
179
-
180
- # 0.3.0
181
-
182
- Add `Docker::API::Volume` methods:
183
- * list
184
- * ~~inspect~~ details
185
- * create
186
- * remove
187
- * prune
188
-
189
-
190
- # 0.2.0
191
-
192
- Add `Docker::API::Image` methods:
193
- * ~~inspect~~ details
194
- * history
195
- * list
196
- * search
197
- * tag
198
- * prune
199
- * remove
200
- * export
201
- * import
202
- * push
203
- * commit
204
- * create
205
- * build
206
- * delete_cache
207
-
208
- Add `Docker::API::System.auth` (untested) for basic authentication
209
-
210
- # 0.1.0
211
-
212
- Add `Docker::API::Container` methods:
213
- * list
214
- * ~~inspect~~ details
215
- * top
216
- * changes
217
- * start
218
- * stop
219
- * restart
220
- * kill
221
- * wait
222
- * update
223
- * rename
224
- * resize
225
- * prune
226
- * pause
227
- * unpause
228
- * remove
229
- * logs
230
- * attach
231
- * create
232
- * stats
233
- * export
234
- * archive
data/bin/setup DELETED
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- #set -vx
5
-
6
- # Do any other automated setup that you need to do here
7
- if [ $USER == 'root' ]
8
- then
9
- echo "Enabling TCP port 2375 for external connection to Docker"
10
- echo '{"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}' > /etc/docker/daemon.json
11
- mkdir -p /etc/systemd/system/docker.service.d
12
- echo '[Service]' > /etc/systemd/system/docker.service.d/override.conf
13
- echo 'ExecStart=' >> /etc/systemd/system/docker.service.d/override.conf
14
- echo 'ExecStart=/usr/bin/dockerd' >> /etc/systemd/system/docker.service.d/override.conf
15
- systemctl daemon-reload
16
- systemctl restart docker.service
17
- echo "Done!"
18
- else
19
- echo "Running bundle install"
20
- bundle install
21
-
22
- echo "Creating self-signed certificate to use in tests"
23
- openssl req -newkey rsa:2048 -nodes -keyout resources/registry_authentication/registry_auth.key -x509 -days 365 -out resources/registry_authentication/registry_auth.crt -subj "/C=CL/ST=Santiago/L=Santiago/O=dockerapi/OU=dockerapi/CN=localhost"
24
-
25
- echo "Creating htpasswd file to use in tests"
26
- docker run --rm --entrypoint htpasswd registry:2.7.0 -Bbn janedoe password > resources/registry_authentication/htpasswd
27
- docker image rm registry:2.7.0
28
- echo "Run this script as root for further configurations"
29
- fi
30
-