Sample backend service which returns request details to the caller. Source: https://github.com/cake-baker/request-info
docker run --rm -p 8080:8080 -e "NAME=Service A" cakebakery/request-info:v1 -addr :8080 -pretty -logH -logB
NAME environment variable to set the name of the service, which will out as a response-read-envs argument if it is required to out environment variables set in container-pretty argument if it is required to out prettified JSONResource Usage
resources:
limits:
cpu: "5m"
memory: "10Mi"
requests:
cpu: "2m"
memory: "5Mi"
Running backend service.
docker run -d -p 8080:8080 -e "NAME=Service A" --name service-A cakebakery/request-info:v1
Sending request to backend service.
curl http://localhost:8080/hello/world
{"Name":"Service A","Request":{"Method":"GET","Header":{"Accept":["*/*"],"User-Agent":["curl/7.54.0"]},"URL":{"Scheme":"","Opaque":"","User":null,"Host":"","Path":"/hello/world","RawPath":"","ForceQuery":false,"RawQuery":"","Fragment":"","RawFragment":""},"ContentLength":0,"TransferEncoding":null,"Host":"localhost:8080","Form":null,"PostForm":null,"MultipartForm":null,"Trailer":null,"RemoteAddr":"172.17.0.1:55922","RequestURI":"/hello/world","TLS":null}}
Remove running service
docker rm -f service-A
Running backend service.
docker run -d -p 8080:8080 -e "NAME=Service A" --name service-A cakebakery/request-info:v1 -read-envs
Sending request to backend service.
curl http://localhost:8080/hello/world
{"Name":"Service A","Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","NAME=Service A","HOME=/root"],"Request":{"Method":"GET","Header":{"Accept":["*/*"],"User-Agent":["curl/7.54.0"]},"URL":{"Scheme":"","Opaque":"","User":null,"Host":"","Path":"/hello/world","RawPath":"","ForceQuery":false,"RawQuery":"","Fragment":"","RawFragment":""},"ContentLength":0,"TransferEncoding":null,"Host":"localhost:8080","Form":null,"PostForm":null,"MultipartForm":null,"Trailer":null,"RemoteAddr":"172.17.0.1:35306","RequestURI":"/hello/world","TLS":null}}
Remove running service
docker rm -f service-A
Running backend service.
docker run -d -p 8080:8080 -e "NAME=Service A" --name service-A cakebakery/request-info:v1 -pretty
Sending request to backend service.
curl http://localhost:8080/hello/world
{
"Name": "Service A",
"Request": {
"Method": "GET",
"Header": {
"Accept": [
"*/*"
],
"User-Agent": [
"curl/7.54.0"
]
},
"URL": {
"Scheme": "",
"Opaque": "",
"User": null,
"Host": "",
"Path": "/hello/world",
"RawPath": "",
"ForceQuery": false,
"RawQuery": "",
"Fragment": "",
"RawFragment": ""
},
"ContentLength": 0,
"TransferEncoding": null,
"Host": "localhost:8080",
"Form": null,
"PostForm": null,
"MultipartForm": null,
"Trailer": null,
"RemoteAddr": "172.17.0.1:44222",
"RequestURI": "/hello/world",
"TLS": null
}
}
Remove running service
docker rm -f service-A
run ./build-docker.sh
Content type
Image
Digest
sha256:0befcdbe8…
Size
6.7 MB
Last updated
over 3 years ago
docker pull cakebakery/request-info:v2