Install httpbin Inside Docker Container in Linux

The httpbin.org is a web service that accepts HTTP requests and returns response. It is useful for testing HTTP clients using various HTTP methods, status codes, response formats, and more. The httpbin is an open-source project which can be installed on own server.

This tutorial explains how to install httpbin inside a Docker container in Linux. Commands have been tested on Ubuntu 20.04 LTS.

Prepare environment

Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.

Install httpbin

Run the following command to create container for httpbin:

docker run -d --name=httpbin --restart=always --network=host kennethreitz/httpbin

By default, httpbin service is listening on port 80. It can be changed with -p option.

docker run -d --name=httpbin --restart=always -p 8080:80 kennethreitz/httpbin

Testing httpbin

Open a web browser and go to http://<IP_ADDRESS>:80, where <IP_ADDRESS> is IP address of the system.

httpbin inside Docker container in Linux

Uninstall httpbin

If you wish to completely uninstall httpbin, remove it's container:

docker rm --force httpbin

Remove httpbin image:

docker rmi kennethreitz/httpbin

Leave a Comment

Your email address will not be published.