A Powerstrip adapter that logs requests to stdout.
$ docker build -t binocarlos/powerstrip-debug .
$ docker run -d --name powerstrip-debug \
--expose 80 \
binocarlos/powerstrip-debug
It can be handy to run the debug adapter in its own shell and leave it attached so you can see its output as requests are made:
$ docker run -ti --rm --name powerstrip-debug \
--expose 80 \
binocarlos/powerstrip-debug
First create a powerstrip configuration with the debug adapter:
$ mkdir -p ~/powerstrip-demo
$ cat > ~/powerstrip-demo/adapters.yml <<EOF
endpoints:
"POST /*/containers/create":
pre: [debug]
"POST /*/containers/*/start":
post: [debug]
adapters:
debug: http://debug/v1/extension
EOF
And then run the powerstrip container and link it to the powerstrip-debug container:
$ docker run -d --name powerstrip \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ~/powerstrip-demo/adapters.yml:/etc/powerstrip/adapters.yml \
--link powerstrip-debug:debug \
-p 2375:2375 \
clusterhq/powerstrip
Now you can use the normal docker client to run containers.
First you must export the DOCKER_HOST
variable to point at the powerstrip server:
$ export DOCKER_HOST=tcp://127.0.0.1:2375
Now - all docker requests are logged to stdout of the powerstrip-debug container:
$ docker run --rm ubuntu echo hello
It is useful to insert the debug container after other adapters so you can see the effect they are having on docker API calls.
This is done by the ordering of the adapters in the powerstrip config file.
The following example will log requests before AND after they are modified by the weave adapter:
endpoints:
"POST /*/containers/create":
pre: [debug, weave, debug]
"POST /*/containers/*/start":
post: [debug, weave, debug]
adapters:
weave: http://weave/v1/extension
debug: http://debug/v1/extension
MIT