Im loking for a docker image that can print the container ID in a web browser, Something like the httpd that prints ("Is Working") but printint the container id.
I want to try if a load balancer that i just set up is working.
You can you this image .
docker run -p 8080:8080 -p 8443:8443 --rm -t mendhak/http-https-echo:18
to start the server and then
curl http://localhost/hello-world
to get headers (including the hostname, which also happens to be this container's ID) back.
UPD:
Another way to get only the hostname is to run something like this:
PORT=8091
docker run --rm -it -e PORT=$PORT -p $PORT:$PORT busybox sh -c \
'while true; do echo -e "HTTP/1.1 200 OK\n\n `cat /etc/hostname`" | nc -l -p $PORT; done'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.