An easy way to test HTTP requests during development or prototyping is httpbin or requestbin - HTTP Request & Response Service.
However, if you debug production issues your requests might contain sensitive data.
Run from a prebuilt image from DockerHub
Lucky you the Git repository kennethreitz/httpbin behind the project already contains a Dockerfile
and is available as prebuilt image.
The documentation is a bit sparse so I decided to publish the few commands needed to run a local httpbin
service using the pre-built image kennethreitz/httpbin
:
docker run -it --rm --publish 8080:8080 kennethreitz/httpbin
Build and run locally
$ git clone git@github.com:kennethreitz/httpbin.git
$ cd httpbin
$ docker build . -t datenkollektiv/httpbin
...
Successfully built 15190579d045
Successfully tagged datenkollektiv/httpbin:latest
Once the image is ready...you can use the local image datenkollektiv/httpbin
as easy as the pre-built image:
docker run -it --rm --publish 8080:8080 datenkollektiv/httpbin
Access and test the httpbin
locally via http://localhost:8080/ip.
$ curl http://localhost:8080/ip
{
"origin": "172.17.0.1"
}
Browse to http://localhost:8080 for a complete list of supported features.
Happy testing...
PS: If you need to track your requests you might want to use requestbin which is capable of recording requests...
git clone git://github.com/Runscope/requestbin.git
cd requestbin
docker-compose build
docker-compose up -d