Install httpbin Inside Docker Container in Linux

Install httpbin Inside Docker Container in Linux

The httpbin.org is a web service that accepts HTTP requests and returns a 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 the own server.

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

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 the IP address of the system.

httpbin inside Docker container in Linux

Uninstall httpbin

If you wish to completely uninstall httpbin, remove its container:

docker rm --force httpbin

Remove httpbin image:

docker rmi kennethreitz/httpbin

The 2 Comments Found

  1. Avatar
    Padmanaban Ilangovan Reply

    Thanks for the article! Can you also explain how to enable https support?

    • Avatar
      lindevs Reply

      Hi,
      Currently, the 80 port is only exposed in the Docker image of the httpbin service. So, I recommend you create Nginx reverse proxy in a separate container and let it handle HTTPS.

Leave a Comment

Cancel reply

Your email address will not be published.