Easy http echo server

Submitted by code_admin on Sun, 01/24/2021 - 17:18

Run the server with

  1. docker run -p 8080:8080 -p 8443:8443 --rm -t mendhak/http-https-echo:17

Test with

  1. curl -k -X PUT -H "Arbitrary:Header" -d aaa=bbb https://localhost:8443/hello-world

Or run it inside my main docker network this is the compose I used:

  1.   echotest:
  2.     image: mendhak/http-https-echo:17
  3.     networks:
  4.      - main_net

Then I made a rule in kong to forward

Service: http://tasks.echotest:8080
Route:
- host: cat-sdts4.metcarob-home.com
- path: /echotest
-

Then I can goto
http://cat-sdts4.metcarob-home.com/echotest
and get the test

This gives me a nice testing endpoint I can test out kong modules with.

Single command to run this on my swarm

  1. docker service create \
  2.   --name echotest \
  3.   --network main_net \
  4.   --constraint 'node.labels.datastore003 == true' \
  5.    mendhak/http-https-echo:17

Test it

  1. curl -v -k -X PUT -H "Arbitrary:Header" -d aaa=bbb tasks.echotest:8443
RJM Article Type
Quick Reference