binocarlos / powerstrip-weave

A Powerstrip plugin that runs weave inside a container and ensures that containers are connected to the weave network before running their entrypoints.
36 stars 3 forks source link

Handling of content type #9

Closed errordeveloper closed 9 years ago

errordeveloper commented 9 years ago

After setting it all up according to the blog post, I ran this:

CID=$(docker run -e "WEAVE_CIDR=10.255.0.51/8" -d busybox)

and got:

server listening on port: 80

undefined:1
No such image: busybox
^
SyntaxError: Unexpected token N
    at Object.parse (native)
    at /srv/app/actions/create.js:47:26
    at /srv/app/dockerclient.js:15:7
    at ConcatStream.<anonymous> (/srv/app/node_modules/concat-stream/index.js:32:43)
    at ConcatStream.emit (events.js:117:20)
    at finishMaybe (/srv/app/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:460:14)
    at afterWrite (/srv/app/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:340:3)
    at /srv/app/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:327:9
    at process._tickCallback (node.js:442:13)
binocarlos commented 9 years ago

Ahhh just found what this is - its because the image is not on the system.

If I first:

$ export DOCKER_HOST=
$ docker pull busybox
$ export DOCKER_HOST=tcp://127.0.0.1:2375
$ CID=$(docker run -e "WEAVE_CIDR=10.255.0.51/8" -d busybox)

Then it runs fine - investigating now - I think pulling images via powerstrip might be hard until we have the HTTP -> TCP hijacking working via the proxy. I think attach and pull are the 2 commands that do the hijacking.

I will put a clear instruction for the user to docker pull binocarlos/powerstrip-weave-example:latest before running the example.

binocarlos commented 9 years ago

Having said that I just did:

$ DOCKER_HOST=tcp://127.0.0.1:2375 docker pull busybox

And it pulled fine - it might just work if I fix up the bug in powerstrip-weave - reporting back presently.

binocarlos commented 9 years ago

Yay - solved this by handling 'No image found: [imagename]' responses properly.

This makes my comments above nonsense - powerstrip can pull images fine :)

Leaving this open for feedback that its made a difference.

errordeveloper commented 9 years ago

@binocarlos should this be closed?

binocarlos commented 9 years ago

yup although I was waiting until I fixed it properly (as in checking for the content-type rather than scan the body for the string "no image found")

binocarlos commented 9 years ago

Am doing this by checking the content-type headers now so am closing....