Last active
August 29, 2015 14:10
-
-
Save tduffield/21a64cd272962b4345fe to your computer and use it in GitHub Desktop.
HTTP interaction against Boot2Docker to create Exec instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resp = conn.post('/exec/350/start', nil, :body => {}.to_json) | |
=> "\u0002\u0000\u0000\u0000\u0000\u0000\u0000,No such exec instance '350' found in daemon\n\u0001\u0000\u0000\u0000\u0000\u0000\u0000ZError starting exec command in container 350: No such exec instance '350' found in daemon\n" | |
resp = conn.post('/containers/known404/exec', nil, :body => {}.to_json) | |
Docker::Error::NotFoundError: Expected([200, 201, 202, 203, 204, 304]) <=> Actual(404 Not Found) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2.1.2 :001 > require 'docker' | |
=> true | |
2.1.2 :002 > conn = Docker.connection | |
=> #<Docker::Connection:0x007fcd8614cc00 @url="tcp://192.168.59.103:2376", @options={:client_cert=>"/Users/tomduffield/.boot2docker/certs/boot2docker-vm/cert.pem", :client_key=>"/Users/tomduffield/.boot2docker/certs/boot2docker-vm/key.pem", :ssl_ca_file=>"/Users/tomduffield/.boot2docker/certs/boot2docker-vm/ca.pem", :scheme=>"https"}> | |
2.1.2 :003 > cid = '88fdc5e376422211cfa86e535992e81f678ccd4e8258c13275e83575ced778d3' | |
=> "88fdc5e376422211cfa86e535992e81f678ccd4e8258c13275e83575ced778d3" | |
2.1.2 :004 > resp = conn.post("/containers/#{cid}/exec", nil, :body => {'Cmd' => %w[date], 'Container' => cid}.to_json) | |
=> "{\"Id\":\"9a2db662cb5bbcb9226e4a7d2a08317f48a1dab849ebbab2d0fa25610240c70b\"}\n" | |
2.1.2 :005 > eid = '9a2db662cb5bbcb9226e4a7d2a08317f48a1dab849ebbab2d0fa25610240c70b' | |
=> "9a2db662cb5bbcb9226e4a7d2a08317f48a1dab849ebbab2d0fa25610240c70b" | |
2.1.2 :006 > resp = conn.post("/exec/#{eid}/start", nil, :body => {}.to_json) | |
=> "" | |
2.1.2 :007 > resp = conn.post("/containers/#{cid}/exec", nil, :body => {'Cmd' => %w[date],'AttachStdout' => true, 'Container' => cid}.to_json) | |
=> "{\"Id\":\"3392b81e327e340be075964a1543f4947aa0abca674cc5146dfa3993704feb6d\"}\n" | |
2.1.2 :008 > eid = '3392b81e327e340be075964a1543f4947aa0abca674cc5146dfa3993704feb6d' | |
=> "3392b81e327e340be075964a1543f4947aa0abca674cc5146dfa3993704feb6d" | |
2.1.2 :009 > resp = conn.post("/exec/#{eid}/start", nil, :body => {}.to_json) | |
=> "\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u001DTue Nov 25 10:33:41 UTC 2014\n" | |
2.1.2 :010 > resp = conn.post("/exec/#{eid}/start", nil, :body => {}.to_json) | |
=> "\x02\x00\x00\x00\x00\x00\x00iNo such exec instance '3392b81e327e340be075964a1543f4947aa0abca674cc5146dfa3993704feb6d' found in daemon\n\x01\x00\x00\x00\x00\x00\x00\xD4Error starting exec command in container 3392b81e327e340be075964a1543f4947aa0abca674cc5146dfa3993704feb6d: No such exec instance '3392b81e327e340be075964a1543f4947aa0abca674cc5146dfa3993704feb6d' found in daemon\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
http_interactions: | |
- request: | |
method: post | |
uri: https://192.168.59.103:2376/v1.15/exec/350/start | |
body: | |
encoding: UTF-8 | |
string: "{}" | |
headers: | |
User-Agent: | |
- Swipely/Docker-API 1.15.0 | |
Content-Type: | |
- application/json | |
response: | |
status: | |
code: 200 | |
message: | |
headers: | |
Content-Type: | |
- application/vnd.docker.raw-stream | |
body: | |
encoding: UTF-8 | |
string: !binary |- | |
AgAAAAAAACxObyBzdWNoIGV4ZWMgaW5zdGFuY2UgJzM1MCcgZm91bmQgaW4g | |
ZGFlbW9uCgEAAAAAAABaRXJyb3Igc3RhcnRpbmcgZXhlYyBjb21tYW5kIGlu | |
IGNvbnRhaW5lciAzNTA6IE5vIHN1Y2ggZXhlYyBpbnN0YW5jZSAnMzUwJyBm | |
b3VuZCBpbiBkYWVtb24K | |
http_version: | |
recorded_at: Tue, 25 Nov 2014 20:17:26 GMT | |
recorded_with: VCR 2.9.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment