docker-api 1.27.0 → 2.0.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.
@@ -1,7 +1,4 @@
1
1
  module Docker
2
2
  # The version of the docker-api gem.
3
- VERSION = '1.27.0'
4
-
5
- # The version of the compatible Docker remote API.
6
- API_VERSION = '1.16'
3
+ VERSION = '2.0.0'
7
4
  end
@@ -29,12 +29,16 @@ class Docker::Volume
29
29
  end
30
30
 
31
31
  # creates a volume with an arbitrary name
32
- def create(name, conn = Docker.connection)
33
- query = {}
34
- query['name'] = name if name
35
- resp = conn.post('/volumes/create', query, :body => query.to_json)
32
+ def create(name, opts = {}, conn = Docker.connection)
33
+ opts['Name'] = name
34
+ resp = conn.post('/volumes/create', {}, body: MultiJson.dump(opts))
36
35
  hash = Docker::Util.parse_json(resp) || {}
37
36
  new(conn, hash)
38
37
  end
38
+
39
+ def prune(conn = Docker.connection)
40
+ conn.post("/volumes/prune")
41
+ end
42
+
39
43
  end
40
44
  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.27.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: 2016-03-29 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
@@ -16,16 +16,16 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.38.0
19
+ version: 0.47.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.38.0
26
+ version: 0.47.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: json
28
+ name: multi_json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: simplecov
112
+ name: single_cov
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -140,37 +140,24 @@ dependencies:
140
140
  name: parallel
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
- version: 1.3.3
145
+ version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
- version: 1.3.3
152
+ version: '0'
153
153
  description: A simple REST client for the Docker Remote API
154
- email:
155
- - tomhulihan@swipely.com
156
- - bright@swipely.com
157
- - toddlunter@swipely.com
154
+ email: tomhulihan@swipely.com bright@swipely.com toddlunter@swipely.com
158
155
  executables: []
159
156
  extensions: []
160
157
  extra_rdoc_files: []
161
158
  files:
162
- - ".cane"
163
- - ".gitignore"
164
- - ".rspec"
165
- - ".simplecov"
166
- - ".travis.yml"
167
- - Dockerfile
168
- - Gemfile
169
159
  - LICENSE
170
160
  - README.md
171
- - Rakefile
172
- - TESTING.md
173
- - docker-api.gemspec
174
161
  - lib/docker-api.rb
175
162
  - lib/docker.rb
176
163
  - lib/docker/base.rb
@@ -188,30 +175,11 @@ files:
188
175
  - lib/docker/version.rb
189
176
  - lib/docker/volume.rb
190
177
  - lib/excon/middlewares/hijack.rb
191
- - script/docker
192
- - script/docker.conf
193
- - script/install_docker.sh
194
- - spec/docker/connection_spec.rb
195
- - spec/docker/container_spec.rb
196
- - spec/docker/event_spec.rb
197
- - spec/docker/exec_spec.rb
198
- - spec/docker/image_spec.rb
199
- - spec/docker/messages_spec.rb
200
- - spec/docker/messages_stack.rb
201
- - spec/docker/network_spec.rb
202
- - spec/docker/util_spec.rb
203
- - spec/docker/volume_spec.rb
204
- - spec/docker_spec.rb
205
- - spec/fixtures/build_from_dir/Dockerfile
206
- - spec/fixtures/export.tar
207
- - spec/fixtures/load.tar
208
- - spec/fixtures/top/Dockerfile
209
- - spec/spec_helper.rb
210
178
  homepage: https://github.com/swipely/docker-api
211
179
  licenses:
212
180
  - MIT
213
181
  metadata: {}
214
- post_install_message:
182
+ post_install_message:
215
183
  rdoc_options: []
216
184
  require_paths:
217
185
  - lib
@@ -226,26 +194,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
194
  - !ruby/object:Gem::Version
227
195
  version: '0'
228
196
  requirements: []
229
- rubyforge_project:
230
- rubygems_version: 2.4.5
231
- signing_key:
197
+ rubygems_version: 3.1.2
198
+ signing_key:
232
199
  specification_version: 4
233
200
  summary: A simple REST client for the Docker Remote API
234
- test_files:
235
- - spec/docker/connection_spec.rb
236
- - spec/docker/container_spec.rb
237
- - spec/docker/event_spec.rb
238
- - spec/docker/exec_spec.rb
239
- - spec/docker/image_spec.rb
240
- - spec/docker/messages_spec.rb
241
- - spec/docker/messages_stack.rb
242
- - spec/docker/network_spec.rb
243
- - spec/docker/util_spec.rb
244
- - spec/docker/volume_spec.rb
245
- - spec/docker_spec.rb
246
- - spec/fixtures/build_from_dir/Dockerfile
247
- - spec/fixtures/export.tar
248
- - spec/fixtures/load.tar
249
- - spec/fixtures/top/Dockerfile
250
- - spec/spec_helper.rb
251
- has_rdoc:
201
+ test_files: []
data/.cane DELETED
@@ -1,2 +0,0 @@
1
- --abc-max 19
2
- --style-measure 100
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- .DS_Store
2
- *.swp
3
- *.gem
4
- Gemfile.lock
5
- coverage/
6
- .ruby-*
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --order rand
data/.simplecov DELETED
@@ -1,4 +0,0 @@
1
- SimpleCov.start do
2
- add_group 'Library', 'lib'
3
- add_group 'Specs', 'spec'
4
- end
@@ -1,25 +0,0 @@
1
- sudo: required
2
- dist: trusty
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.2
7
- - 2.1
8
- - 2.0
9
- - 1.9.3
10
- env:
11
- - DOCKER_VERSION=1.10.3
12
- - DOCKER_VERSION=1.9.1
13
- - DOCKER_VERSION=1.8.2
14
- - DOCKER_VERSION=1.7.1
15
- - DOCKER_VERSION=1.6.2
16
- matrix:
17
- fast_finish: true
18
- before_install:
19
- - docker --version
20
- - gem install bundler
21
- before_script:
22
- - sudo ./script/install_docker.sh ${DOCKER_VERSION}
23
- - uname -a
24
- - docker --version
25
- - docker info
data/Dockerfile DELETED
@@ -1,2 +0,0 @@
1
- FROM scratch
2
- ADD Dockerfile /Dockerfile
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gemspec
data/Rakefile DELETED
@@ -1,54 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
2
- ENV['PATH'] = "/opt/docker/:#{ENV['PATH']}" if ENV['CI'] == 'true'
3
-
4
- require 'rake'
5
- require 'docker'
6
- require 'rspec/core/rake_task'
7
- require 'cane/rake_task'
8
-
9
-
10
- desc 'Run the full test suite from scratch'
11
- task :default => [:unpack, :rspec, :quality]
12
-
13
- RSpec::Core::RakeTask.new do |t|
14
- t.pattern = 'spec/**/*_spec.rb'
15
- end
16
-
17
- Cane::RakeTask.new(:quality) do |cane|
18
- cane.canefile = '.cane'
19
- end
20
-
21
- desc 'Download the necessary base images'
22
- task :unpack do
23
- %w( swipely/base registry busybox tianon/true debian:wheezy ).each do |image|
24
- system "docker pull #{image}"
25
- end
26
- end
27
-
28
- desc 'Run spec tests with a registry'
29
- task :rspec do
30
- begin
31
- registry = Docker::Container.create(
32
- 'name' => 'registry',
33
- 'Image' => 'registry',
34
- 'Env' => ["GUNICORN_OPTS=[--preload]"],
35
- 'ExposedPorts' => {
36
- '5000/tcp' => {}
37
- },
38
- 'HostConfig' => {
39
- 'PortBindings' => { '5000/tcp' => [{ 'HostPort' => '5000' }] }
40
- }
41
- )
42
- registry.start
43
- Rake::Task["spec"].invoke
44
- ensure
45
- registry.kill!.remove unless registry.nil?
46
- end
47
- end
48
-
49
- desc 'Pull an Ubuntu image'
50
- image 'ubuntu:13.10' do
51
- puts "Pulling ubuntu:13.10"
52
- image = Docker::Image.create('fromImage' => 'ubuntu', 'tag' => '13.10')
53
- puts "Pulled ubuntu:13.10, image id: #{image.id}"
54
- end
data/TESTING.md DELETED
@@ -1,49 +0,0 @@
1
- # Prerequisites
2
- To develop on this gem, you must the following installed:
3
- * a sane Ruby 1.9+ environment with `bundler`
4
- ```shell
5
- $ gem install bundler
6
- ```
7
- * Docker v1.3.1 or greater
8
-
9
-
10
-
11
- # Getting Started
12
- 1. Clone the git repository from Github:
13
- ```shell
14
- $ git clone git@github.com:swipely/docker-api.git
15
- ```
16
- 2. Install the dependencies using Bundler
17
- ```shell
18
- $ bundle install
19
- ```
20
- 3. Create a branch for your changes
21
- ```shell
22
- $ git checkout -b my_bug_fix
23
- ```
24
- 4. Make any changes
25
- 5. Write tests to support those changes.
26
- 6. Run the tests:
27
- * `bundle exec rake`
28
- 7. Assuming the tests pass, open a Pull Request on Github.
29
-
30
- # Using Rakefile Commands
31
- This repository comes with five Rake commands to assist in your testing of the code.
32
-
33
- ## `rake rspec`
34
- This command will run Rspec tests normally on your local system. You must have all the required base images pulled.
35
-
36
- ## `rake quality`
37
- This command runs a code quality threshold checker to hinder bad code.
38
-
39
- ## `rake unpack`
40
- Pulls down all the required base images for testing.
41
-
42
- ### Setting Up Environment Variables
43
- Certain Rspec tests will require your credentials to the Docker Hub. If you do not have a Docker Hub account, you can sign up for one [here](https://hub.docker.com/account/signup/). To avoid hard-coding credentials into the code the test suite leverages three Environment Variables: `DOCKER_API_USER`, `DOCKER_API_PASS`, and `DOCKER_API_EMAIL`. You will need to configure your work environment (shell profile, IDE, etc) with these values in order to successfully run certain tests.
44
-
45
- ```shell
46
- export DOCKER_API_USER='your_docker_hub_user'
47
- export DOCKER_API_PASS='your_docker_hub_password'
48
- export DOCKER_API_EMAIL='your_docker_hub_email_address'
49
- ```
@@ -1,28 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/docker/version', __FILE__)
3
-
4
- Gem::Specification.new do |gem|
5
- gem.authors = ["Swipely, Inc."]
6
- gem.email = %w{tomhulihan@swipely.com bright@swipely.com toddlunter@swipely.com}
7
- gem.description = %q{A simple REST client for the Docker Remote API}
8
- gem.summary = %q{A simple REST client for the Docker Remote API}
9
- gem.homepage = 'https://github.com/swipely/docker-api'
10
- gem.license = 'MIT'
11
- gem.files = `git ls-files`.split($\)
12
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
- gem.name = "docker-api"
15
- gem.require_paths = %w{lib}
16
- gem.version = Docker::VERSION
17
- gem.add_dependency 'excon', '>= 0.38.0'
18
- gem.add_dependency 'json'
19
- gem.add_development_dependency 'rake'
20
- gem.add_development_dependency 'rspec', '~> 3.0'
21
- gem.add_development_dependency 'rspec-its'
22
- gem.add_development_dependency 'cane'
23
- gem.add_development_dependency 'pry'
24
- gem.add_development_dependency 'simplecov'
25
- gem.add_development_dependency 'webmock'
26
- # > 1.3.4 doesn't support ruby 1.9.2
27
- gem.add_development_dependency 'parallel', '1.3.3'
28
- end
@@ -1,149 +0,0 @@
1
- #!/bin/sh
2
- set -e
3
-
4
- ### BEGIN INIT INFO
5
- # Provides: docker
6
- # Required-Start: $syslog $remote_fs
7
- # Required-Stop: $syslog $remote_fs
8
- # Should-Start: cgroupfs-mount cgroup-lite
9
- # Should-Stop: cgroupfs-mount cgroup-lite
10
- # Default-Start: 2 3 4 5
11
- # Default-Stop: 0 1 6
12
- # Short-Description: Create lightweight, portable, self-sufficient containers.
13
- # Description:
14
- # Docker is an open-source project to easily create lightweight, portable,
15
- # self-sufficient containers from any application. The same container that a
16
- # developer builds and tests on a laptop can run at scale, in production, on
17
- # VMs, bare metal, OpenStack clusters, public clouds and more.
18
- ### END INIT INFO
19
-
20
- export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
21
-
22
- BASE=$(basename $0)
23
-
24
- # modify these in /etc/default/$BASE (/etc/default/docker)
25
- DOCKER=/usr/bin/$BASE
26
- # This is the pid file managed by docker itself
27
- DOCKER_PIDFILE=/var/run/$BASE.pid
28
- # This is the pid file created/managed by start-stop-daemon
29
- DOCKER_SSD_PIDFILE=/var/run/$BASE-ssd.pid
30
- DOCKER_LOGFILE=/var/log/$BASE.log
31
- DOCKER_OPTS=
32
- DOCKER_DESC="Docker"
33
-
34
- # Get lsb functions
35
- . /lib/lsb/init-functions
36
-
37
- if [ -f /etc/default/$BASE ]; then
38
- . /etc/default/$BASE
39
- fi
40
-
41
- # Check docker is present
42
- if [ ! -x $DOCKER ]; then
43
- log_failure_msg "$DOCKER not present or not executable"
44
- exit 1
45
- fi
46
-
47
- check_init() {
48
- # see also init_is_upstart in /lib/lsb/init-functions (which isn't available in Ubuntu 12.04, or we'd use it directly)
49
- if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | grep -q upstart; then
50
- log_failure_msg "$DOCKER_DESC is managed via upstart, try using service $BASE $1"
51
- exit 1
52
- fi
53
- }
54
-
55
- fail_unless_root() {
56
- if [ "$(id -u)" != '0' ]; then
57
- log_failure_msg "$DOCKER_DESC must be run as root"
58
- exit 1
59
- fi
60
- }
61
-
62
- cgroupfs_mount() {
63
- # see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
64
- if grep -v '^#' /etc/fstab | grep -q cgroup \
65
- || [ ! -e /proc/cgroups ] \
66
- || [ ! -d /sys/fs/cgroup ]; then
67
- return
68
- fi
69
- if ! mountpoint -q /sys/fs/cgroup; then
70
- mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
71
- fi
72
- (
73
- cd /sys/fs/cgroup
74
- for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
75
- mkdir -p $sys
76
- if ! mountpoint -q $sys; then
77
- if ! mount -n -t cgroup -o $sys cgroup $sys; then
78
- rmdir $sys || true
79
- fi
80
- fi
81
- done
82
- )
83
- }
84
-
85
- case "$1" in
86
- start)
87
- check_init
88
-
89
- fail_unless_root
90
-
91
- cgroupfs_mount
92
-
93
- touch "$DOCKER_LOGFILE"
94
- chgrp docker "$DOCKER_LOGFILE"
95
-
96
- ulimit -n 1048576
97
- if [ "$BASH" ]; then
98
- ulimit -u 1048576
99
- else
100
- ulimit -p 1048576
101
- fi
102
-
103
- log_begin_msg "Starting $DOCKER_DESC: $BASE"
104
- start-stop-daemon --start --background \
105
- --no-close \
106
- --exec "$DOCKER" \
107
- --pidfile "$DOCKER_SSD_PIDFILE" \
108
- --make-pidfile \
109
- -- \
110
- -d -p "$DOCKER_PIDFILE" \
111
- $DOCKER_OPTS \
112
- >> "$DOCKER_LOGFILE" 2>&1
113
- log_end_msg $?
114
- ;;
115
-
116
- stop)
117
- check_init
118
- fail_unless_root
119
- log_begin_msg "Stopping $DOCKER_DESC: $BASE"
120
- start-stop-daemon --stop --pidfile "$DOCKER_SSD_PIDFILE"
121
- log_end_msg $?
122
- ;;
123
-
124
- restart)
125
- check_init
126
- fail_unless_root
127
- docker_pid=`cat "$DOCKER_SSD_PIDFILE" 2>/dev/null`
128
- [ -n "$docker_pid" ] \
129
- && ps -p $docker_pid > /dev/null 2>&1 \
130
- && $0 stop
131
- $0 start
132
- ;;
133
-
134
- force-reload)
135
- check_init
136
- fail_unless_root
137
- $0 restart
138
- ;;
139
-
140
- status)
141
- check_init
142
- status_of_proc -p "$DOCKER_SSD_PIDFILE" "$DOCKER" "$DOCKER_DESC"
143
- ;;
144
-
145
- *)
146
- echo "Usage: service docker {start|stop|restart|status}"
147
- exit 1
148
- ;;
149
- esac