Shows host information where the app is running
332
Simple HTTP docker service that prints it's container ID. In addition, it can show version and environments as response headers. This is useful to verify kubernetes deployments with versions and rollouts.
$ ./build-and-run.sh
...
...
Step 14/14 : CMD ["/app/http"]
---> Running in c1644aedd2bc
Removing intermediate container c1644aedd2bc
---> 42ff86ea56a1
Successfully built 42ff86ea56a1
Successfully tagged marcellodesales/whoami:latest
Recreating whoami_whoami_1 ... done
Attaching to whoami_whoami_1
whoami_1 | WhoAmI Server version=95dd08c label=develop env=prodListening on d5aca8c3ba93:8000
whoami_1 |
docker-compose.$ curl -i localhost:8000
HTTP/1.1 200 OK
X-Application-Env: prod
X-Application-Label: develop
X-Application-Port: 8000
X-Application-Version: 95dd08c
Date: Thu, 15 Feb 2018 21:54:16 GMT
Content-Length: 71
Content-Type: text/plain; charset=utf-8
I'm d5aca8c3ba93 serving request user-agent: curl/7.54.0, accept: */*
Successfully built 42ff86ea56a1
Successfully tagged marcellodesales/whoami:latest
Recreating whoami_whoami_1 ... done
Attaching to whoami_whoami_1
whoami_1 | WhoAmI Server version=95dd08c label=develop env=prodListening on d5aca8c3ba93:8000
whoami_1 |
whoami_1 | This is server d5aca8c3ba93:8000, version=95dd08c label=develop env=prod, serving request user-agent: curl/7.54.0, accept: */*
$ docker exec -ti d5aca8c3ba93 cat /app/label
develop
$ docker exec -ti d5aca8c3ba93 cat /app/version
95dd08c
$ docker run -d -p 8000:8000 --name whoami -t marcellodesales/whoami
736ab83847bb12dddd8b09969433f3a02d64d5b0be48f7a5c59a594e3a6a3541
$ curl $(hostname --all-ip-addresses | awk '{print $1}'):8000
I'm 736ab83847bb
docker pull marcellodesales/whoami:latest