docker-api 1.0.1 → 1.1.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.
Files changed (55) hide show
  1. data/README.md +2 -0
  2. data/lib/docker.rb +12 -2
  3. data/lib/docker/connection.rb +42 -49
  4. data/lib/docker/container.rb +12 -20
  5. data/lib/docker/error.rb +3 -0
  6. data/lib/docker/image.rb +21 -47
  7. data/lib/docker/model.rb +17 -14
  8. data/lib/docker/util.rb +12 -0
  9. data/lib/docker/version.rb +5 -1
  10. data/spec/docker/connection_spec.rb +56 -30
  11. data/spec/docker/container_spec.rb +81 -201
  12. data/spec/docker/image_spec.rb +48 -157
  13. data/spec/docker/util_spec.rb +43 -0
  14. data/spec/docker_spec.rb +15 -0
  15. data/spec/vcr/Docker/_info/returns_the_info_as_a_Hash.yml +10 -8
  16. data/spec/vcr/Docker/_validate_version/when_nothing_is_raised/validate_version_/.yml +33 -0
  17. data/spec/vcr/Docker/_version/returns_the_version_as_a_Hash.yml +10 -8
  18. data/spec/vcr/Docker_Container/_all/when_the_HTTP_response_is_a_200/materializes_each_Container_into_a_Docker_Container.yml +857 -17
  19. data/spec/vcr/Docker_Container/_attach/{when_the_HTTP_response_status_is_200/yields_each_chunk.yml → yields_each_chunk.yml} +9 -9
  20. data/spec/vcr/Docker_Container/_changes/{when_the_HTTP_response_status_is_200/returns_the_changes_as_an_array.yml → returns_the_changes_as_an_array.yml} +13 -13
  21. data/spec/vcr/Docker_Container/_commit/{when_the_HTTP_response_status_is_200/creates_a_new_Image_from_the_Container_s_changes.yml → creates_a_new_Image_from_the_Container_s_changes.yml} +12 -12
  22. data/spec/vcr/Docker_Container/_create/when_the_Container_does_not_yet_exist_and_the_body_is_a_Hash/when_the_HTTP_request_returns_a_200/sets_the_id.yml +4 -4
  23. data/spec/vcr/Docker_Container/_export/{when_the_HTTP_response_status_is_200/yields_each_chunk.yml → yields_each_chunk.yml} +11 -11
  24. data/spec/vcr/Docker_Container/_json/{when_the_HTTP_response_status_is_200/returns_the_description_as_a_Hash.yml → returns_the_description_as_a_Hash.yml} +8 -8
  25. data/spec/vcr/Docker_Container/_kill/{when_the_HTTP_response_status_is_204/kills_the_container.yml → kills_the_container.yml} +436 -16
  26. data/spec/vcr/Docker_Container/_restart/{when_the_HTTP_response_status_is_204/restarts_the_container.yml → restarts_the_container.yml} +29 -29
  27. data/spec/vcr/Docker_Container/_start/{when_the_HTTP_response_status_is_200/starts_the_container.yml → starts_the_container.yml} +12 -12
  28. data/spec/vcr/Docker_Container/_stop/{when_the_HTTP_response_status_is_204/stops_the_container.yml → stops_the_container.yml} +440 -20
  29. data/spec/vcr/Docker_Container/_wait/{when_the_HTTP_response_status_is_200/waits_for_the_command_to_finish.yml → waits_for_the_command_to_finish.yml} +10 -10
  30. data/spec/vcr/Docker_Image/_all/materializes_each_Image_into_a_Docker_Image.yml +65 -0
  31. data/spec/vcr/Docker_Image/_build/with_a_valid_Dockerfile/builds_an_image.yml +9 -5
  32. data/spec/vcr/Docker_Image/_build/with_an_invalid_Dockerfile/throws_a_UnexpectedResponseError.yml +9 -5
  33. data/spec/vcr/Docker_Image/_build_from_dir/with_a_valid_Dockerfile/builds_the_image.yml +17 -15
  34. data/spec/vcr/Docker_Image/{_create_/when_the_Image_does_not_yet_exist_and_the_body_is_a_Hash/when_the_HTTP_request_returns_a_200 → _create/when_the_Image_does_not_yet_exist_and_the_body_is_a_Hash}/sets_the_id.yml +4 -2
  35. data/spec/vcr/Docker_Image/_history/{when_the_Image_has_been_created/when_the_HTTP_response_status_is_200/returns_the_history_of_the_Image.yml → returns_the_history_of_the_Image.yml} +7 -5
  36. data/spec/vcr/Docker_Image/_import/when_the_file_does_exist/creates_the_Image.yml +6 -6
  37. data/spec/vcr/Docker_Image/_insert/{when_the_Image_has_been_created/when_the_HTTP_response_status_is_200/inserts_the_url_s_file_into_a_new_Image.yml → inserts_the_url_s_file_into_a_new_Image.yml} +30 -29
  38. data/spec/vcr/Docker_Image/_json/{when_the_Image_has_been_created/when_the_HTTP_response_status_is_200/returns_additional_information_about_image_image.yml → returns_additional_information_about_image_image.yml} +7 -5
  39. data/spec/vcr/Docker_Image/_remove/removes_the_Image.yml +95 -0
  40. data/spec/vcr/Docker_Image/_run/when_the_argument_is_a_String/splits_the_String_by_spaces_and_creates_a_new_Container.yml +14 -12
  41. data/spec/vcr/Docker_Image/_run/when_the_argument_is_an_Array/creates_a_new_Container.yml +14 -12
  42. data/spec/vcr/Docker_Image/_search/{when_the_HTTP_response_is_a_200/materializes_each_Image_into_a_Docker_Image.yml → materializes_each_Image_into_a_Docker_Image.yml} +4 -34
  43. data/spec/vcr/Docker_Image/_tag/{when_the_Image_has_been_created/when_the_HTTP_response_status_is_200/tags_the_image_with_the_repo_name.yml → tags_the_image_with_the_repo_name.yml} +7 -5
  44. metadata +43 -56
  45. data/spec/vcr/Docker_Image/_all/when_the_HTTP_response_is_a_200/materializes_each_Image_into_a_Docker_Image.yml +0 -63
  46. data/spec/vcr/Docker_Image/_create/when_the_Image_does_not_yet_exist_and_the_body_is_a_Hash/when_the_HTTP_request_returns_a_200/sets_the_id.yml +0 -33
  47. data/spec/vcr/Docker_Image/_history/when_the_HTTP_response_status_is_200/returns_the_history_of_the_Image.yml +0 -63
  48. data/spec/vcr/Docker_Image/_insert/when_the_HTTP_response_status_is_200/inserts_the_url_s_file_into_a_new_Image.yml +0 -220
  49. data/spec/vcr/Docker_Image/_json/when_the_HTTP_response_status_is_200/returns_additional_information_about_image_image.yml +0 -63
  50. data/spec/vcr/Docker_Image/_remove/when_the_HTTP_response_status_is_204/removes_the_Image.yml +0 -93
  51. data/spec/vcr/Docker_Image/_remove/when_the_Image_has_been_created/when_the_HTTP_response_status_is_204/nils_out_the_id.yml +0 -63
  52. data/spec/vcr/Docker_Image/_remove/when_the_Image_has_been_created/when_the_HTTP_response_status_is_204/removes_the_Image.yml +0 -63
  53. data/spec/vcr/Docker_Image/_run/when_the_Image_has_been_created/when_the_argument_is_a_String/splits_the_String_by_spaces_and_creates_a_new_Container.yml +0 -119
  54. data/spec/vcr/Docker_Image/_run/when_the_Image_has_been_created/when_the_argument_is_an_Array/creates_a_new_Container.yml +0 -119
  55. data/spec/vcr/Docker_Image/_tag/when_the_HTTP_response_status_is_200/tags_the_image_with_the_repo_name.yml +0 -63
@@ -1,63 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: http://localhost:4243/v1.3/images/create?fromImage=base
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Docker-Client/0.4.6
12
- response:
13
- status:
14
- code: 200
15
- message: ''
16
- headers:
17
- !binary "Q29udGVudC1UeXBl":
18
- - !binary |-
19
- YXBwbGljYXRpb24vanNvbg==
20
- !binary "RGF0ZQ==":
21
- - !binary |-
22
- U3VuLCAyMyBKdW4gMjAxMyAxOTo0Mzo0MCBHTVQ=
23
- !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
24
- - !binary |-
25
- Y2h1bmtlZA==
26
- body:
27
- encoding: US-ASCII
28
- string: ! '{"status":"Pulling repository base from https://index.docker.io/v1"}{"status":"Pulling
29
- image 27cf784147099545 () from base"}{"status":"Pulling image b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc
30
- (ubuntu-quantl) from base"}'
31
- http_version:
32
- recorded_at: Sun, 23 Jun 2013 19:43:41 GMT
33
- - request:
34
- method: delete
35
- uri: http://localhost:4243/images/base
36
- body:
37
- encoding: US-ASCII
38
- string: ''
39
- headers:
40
- Content-Type:
41
- - text/plain
42
- User-Agent:
43
- - Docker-Client/0.4.6
44
- response:
45
- status:
46
- code: 200
47
- message: ''
48
- headers:
49
- !binary "Q29udGVudC1UeXBl":
50
- - !binary |-
51
- YXBwbGljYXRpb24vanNvbg==
52
- !binary "Q29udGVudC1MZW5ndGg=":
53
- - !binary |-
54
- Mjk=
55
- !binary "RGF0ZQ==":
56
- - !binary |-
57
- U3VuLCAyMyBKdW4gMjAxMyAxOTo0Mzo0MSBHTVQ=
58
- body:
59
- encoding: US-ASCII
60
- string: ! '[{"Untagged":"b750fe79269d"}]'
61
- http_version:
62
- recorded_at: Sun, 23 Jun 2013 19:43:41 GMT
63
- recorded_with: VCR 2.5.0
@@ -1,63 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: http://localhost:4243/images/create?fromImage=base
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Docker-Client/0.4.6
12
- response:
13
- status:
14
- code: 200
15
- message: ''
16
- headers:
17
- !binary "Q29udGVudC1UeXBl":
18
- - !binary |-
19
- YXBwbGljYXRpb24vanNvbg==
20
- !binary "RGF0ZQ==":
21
- - !binary |-
22
- TW9uLCAyNCBKdW4gMjAxMyAxOTo0NTo0NiBHTVQ=
23
- !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
24
- - !binary |-
25
- Y2h1bmtlZA==
26
- body:
27
- encoding: US-ASCII
28
- string: ! '{"status":"Pulling repository base from https://index.docker.io/v1"}{"status":"Pulling
29
- image 27cf784147099545 () from base"}{"status":"Pulling image b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc
30
- (ubuntu-quantl) from base"}'
31
- http_version:
32
- recorded_at: Mon, 24 Jun 2013 19:45:47 GMT
33
- - request:
34
- method: delete
35
- uri: http://localhost:4243/images/base
36
- body:
37
- encoding: US-ASCII
38
- string: ''
39
- headers:
40
- Content-Type:
41
- - text/plain
42
- User-Agent:
43
- - Docker-Client/0.4.6
44
- response:
45
- status:
46
- code: 200
47
- message: ''
48
- headers:
49
- !binary "Q29udGVudC1UeXBl":
50
- - !binary |-
51
- YXBwbGljYXRpb24vanNvbg==
52
- !binary "Q29udGVudC1MZW5ndGg=":
53
- - !binary |-
54
- Mjk=
55
- !binary "RGF0ZQ==":
56
- - !binary |-
57
- TW9uLCAyNCBKdW4gMjAxMyAxOTo0NTo0NyBHTVQ=
58
- body:
59
- encoding: US-ASCII
60
- string: ! '[{"Untagged":"b750fe79269d"}]'
61
- http_version:
62
- recorded_at: Mon, 24 Jun 2013 19:45:47 GMT
63
- recorded_with: VCR 2.5.0
@@ -1,119 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: http://localhost:4243/v1.3/images/create?fromImage=base
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Docker-Client/0.4.6
12
- response:
13
- status:
14
- code: 200
15
- message: ''
16
- headers:
17
- !binary "Q29udGVudC1UeXBl":
18
- - !binary |-
19
- YXBwbGljYXRpb24vanNvbg==
20
- !binary "RGF0ZQ==":
21
- - !binary |-
22
- TW9uLCAyNCBKdW4gMjAxMyAxNToyMjo1NiBHTVQ=
23
- !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
24
- - !binary |-
25
- Y2h1bmtlZA==
26
- body:
27
- encoding: US-ASCII
28
- string: ! '{"status":"Pulling repository base from https://index.docker.io/v1"}{"status":"Pulling
29
- image 27cf784147099545 () from base"}{"status":"Pulling image b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc
30
- (ubuntu-quantl) from base"}'
31
- http_version:
32
- recorded_at: Mon, 24 Jun 2013 15:22:58 GMT
33
- - request:
34
- method: post
35
- uri: http://localhost:4243/containers/create
36
- body:
37
- encoding: UTF-8
38
- string: ! '{"Image":"base","Cmd":["ls","/lib64/"]}'
39
- headers:
40
- Content-Type:
41
- - text/plain
42
- User-Agent:
43
- - Docker-Client/0.4.6
44
- response:
45
- status:
46
- code: 201
47
- message: ''
48
- headers:
49
- !binary "Q29udGVudC1UeXBl":
50
- - !binary |-
51
- dGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOA==
52
- !binary "Q29udGVudC1MZW5ndGg=":
53
- - !binary |-
54
- MjE=
55
- !binary "RGF0ZQ==":
56
- - !binary |-
57
- TW9uLCAyNCBKdW4gMjAxMyAxNToyMjo1OCBHTVQ=
58
- body:
59
- encoding: US-ASCII
60
- string: ! '{"Id":"24e7712c2a1e"}'
61
- http_version:
62
- recorded_at: Mon, 24 Jun 2013 15:22:58 GMT
63
- - request:
64
- method: post
65
- uri: http://localhost:4243/containers/24e7712c2a1e/start
66
- body:
67
- encoding: US-ASCII
68
- string: ''
69
- headers:
70
- Content-Type:
71
- - text/plain
72
- User-Agent:
73
- - Docker-Client/0.4.6
74
- response:
75
- status:
76
- code: 204
77
- message: ''
78
- headers:
79
- !binary "Q29udGVudC1UeXBl":
80
- - !binary |-
81
- dGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOA==
82
- !binary "Q29udGVudC1MZW5ndGg=":
83
- - !binary |-
84
- MA==
85
- !binary "RGF0ZQ==":
86
- - !binary |-
87
- TW9uLCAyNCBKdW4gMjAxMyAxNToyMjo1OCBHTVQ=
88
- body:
89
- encoding: US-ASCII
90
- string: ''
91
- http_version:
92
- recorded_at: Mon, 24 Jun 2013 15:22:58 GMT
93
- - request:
94
- method: post
95
- uri: http://localhost:4243/containers/24e7712c2a1e/attach?stdout=true&stream=true
96
- body:
97
- encoding: US-ASCII
98
- string: ''
99
- headers:
100
- Content-Type:
101
- - text/plain
102
- User-Agent:
103
- - Docker-Client/0.4.6
104
- response:
105
- status:
106
- code: 200
107
- message: ''
108
- headers:
109
- !binary "Q29udGVudC1UeXBl":
110
- - !binary |-
111
- YXBwbGljYXRpb24vdm5kLmRvY2tlci5yYXctc3RyZWFt
112
- body:
113
- encoding: US-ASCII
114
- string: ! 'ld-linux-x86-64.so.2
115
-
116
- '
117
- http_version:
118
- recorded_at: Mon, 24 Jun 2013 15:22:58 GMT
119
- recorded_with: VCR 2.5.0
@@ -1,119 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: http://localhost:4243/v1.3/images/create?fromImage=base
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Docker-Client/0.4.6
12
- response:
13
- status:
14
- code: 200
15
- message: ''
16
- headers:
17
- !binary "Q29udGVudC1UeXBl":
18
- - !binary |-
19
- YXBwbGljYXRpb24vanNvbg==
20
- !binary "RGF0ZQ==":
21
- - !binary |-
22
- TW9uLCAyNCBKdW4gMjAxMyAxNToyMjo1OCBHTVQ=
23
- !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
24
- - !binary |-
25
- Y2h1bmtlZA==
26
- body:
27
- encoding: US-ASCII
28
- string: ! '{"status":"Pulling repository base from https://index.docker.io/v1"}{"status":"Pulling
29
- image 27cf784147099545 () from base"}{"status":"Pulling image b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc
30
- (ubuntu-quantl) from base"}'
31
- http_version:
32
- recorded_at: Mon, 24 Jun 2013 15:22:59 GMT
33
- - request:
34
- method: post
35
- uri: http://localhost:4243/containers/create
36
- body:
37
- encoding: UTF-8
38
- string: ! '{"Image":"base","Cmd":["which","pwd"]}'
39
- headers:
40
- Content-Type:
41
- - text/plain
42
- User-Agent:
43
- - Docker-Client/0.4.6
44
- response:
45
- status:
46
- code: 201
47
- message: ''
48
- headers:
49
- !binary "Q29udGVudC1UeXBl":
50
- - !binary |-
51
- dGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOA==
52
- !binary "Q29udGVudC1MZW5ndGg=":
53
- - !binary |-
54
- MjE=
55
- !binary "RGF0ZQ==":
56
- - !binary |-
57
- TW9uLCAyNCBKdW4gMjAxMyAxNToyMjo1OSBHTVQ=
58
- body:
59
- encoding: US-ASCII
60
- string: ! '{"Id":"4dcde7128f17"}'
61
- http_version:
62
- recorded_at: Mon, 24 Jun 2013 15:22:59 GMT
63
- - request:
64
- method: post
65
- uri: http://localhost:4243/containers/4dcde7128f17/start
66
- body:
67
- encoding: US-ASCII
68
- string: ''
69
- headers:
70
- Content-Type:
71
- - text/plain
72
- User-Agent:
73
- - Docker-Client/0.4.6
74
- response:
75
- status:
76
- code: 204
77
- message: ''
78
- headers:
79
- !binary "Q29udGVudC1UeXBl":
80
- - !binary |-
81
- dGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOA==
82
- !binary "Q29udGVudC1MZW5ndGg=":
83
- - !binary |-
84
- MA==
85
- !binary "RGF0ZQ==":
86
- - !binary |-
87
- TW9uLCAyNCBKdW4gMjAxMyAxNToyMjo1OSBHTVQ=
88
- body:
89
- encoding: US-ASCII
90
- string: ''
91
- http_version:
92
- recorded_at: Mon, 24 Jun 2013 15:22:59 GMT
93
- - request:
94
- method: post
95
- uri: http://localhost:4243/containers/4dcde7128f17/attach?stdout=true&stream=true
96
- body:
97
- encoding: US-ASCII
98
- string: ''
99
- headers:
100
- Content-Type:
101
- - text/plain
102
- User-Agent:
103
- - Docker-Client/0.4.6
104
- response:
105
- status:
106
- code: 200
107
- message: ''
108
- headers:
109
- !binary "Q29udGVudC1UeXBl":
110
- - !binary |-
111
- YXBwbGljYXRpb24vdm5kLmRvY2tlci5yYXctc3RyZWFt
112
- body:
113
- encoding: US-ASCII
114
- string: ! '/bin/pwd
115
-
116
- '
117
- http_version:
118
- recorded_at: Mon, 24 Jun 2013 15:22:59 GMT
119
- recorded_with: VCR 2.5.0
@@ -1,63 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: http://localhost:4243/images/create?fromImage=base
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Docker-Client/0.4.6
12
- response:
13
- status:
14
- code: 200
15
- message: ''
16
- headers:
17
- !binary "Q29udGVudC1UeXBl":
18
- - !binary |-
19
- YXBwbGljYXRpb24vanNvbg==
20
- !binary "RGF0ZQ==":
21
- - !binary |-
22
- TW9uLCAyNCBKdW4gMjAxMyAxOTo0ODo0MSBHTVQ=
23
- !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
24
- - !binary |-
25
- Y2h1bmtlZA==
26
- body:
27
- encoding: US-ASCII
28
- string: ! '{"status":"Pulling repository base from https://index.docker.io/v1"}{"status":"Pulling
29
- image 27cf784147099545 () from base"}{"status":"Pulling image b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc
30
- (ubuntu-quantl) from base"}'
31
- http_version:
32
- recorded_at: Mon, 24 Jun 2013 19:48:43 GMT
33
- - request:
34
- method: post
35
- uri: http://localhost:4243/images/base/tag?force=true&repo=base2
36
- body:
37
- encoding: US-ASCII
38
- string: ''
39
- headers:
40
- Content-Type:
41
- - text/plain
42
- User-Agent:
43
- - Docker-Client/0.4.6
44
- response:
45
- status:
46
- code: 201
47
- message: ''
48
- headers:
49
- !binary "Q29udGVudC1UeXBl":
50
- - !binary |-
51
- dGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOA==
52
- !binary "Q29udGVudC1MZW5ndGg=":
53
- - !binary |-
54
- MA==
55
- !binary "RGF0ZQ==":
56
- - !binary |-
57
- TW9uLCAyNCBKdW4gMjAxMyAxOTo0ODo0MyBHTVQ=
58
- body:
59
- encoding: US-ASCII
60
- string: ''
61
- http_version:
62
- recorded_at: Mon, 24 Jun 2013 19:48:43 GMT
63
- recorded_with: VCR 2.5.0