Skip to content

A docker image for simple http server which returns $HOSTNAME

Notifications You must be signed in to change notification settings

octarect/docker-hostname

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-hostname

This is a simple docker image which just shows $HOSTNAME. It is built from library/nginx.

Official nginx images are automatically patched and pushed into GitHub Container Registry. See https://github.com/octarect/docker-hostname/pkgs/container/hostname

Usage

Available tags are listed in https://github.com/octarect/docker-hostname/pkgs/container/hostname/versions

Docker

docker run -d --name hostname -p 8080:80 ghcr.io/octarect/hostname:latest

Test:

$ curl localhost:8080
29d607790136

Kubernetes

kubectl create deployment hostname --image=ghcr.io/octarect/hostname:1.21.6-alpine --replicas=3

Then you can test it by the following;

$ kubectl get pod
NAME                        READY   STATUS    RESTARTS   AGE
hostname-59b54b98fd-62rbw   1/1     Running   0          11s
hostname-59b54b98fd-8z6cb   1/1     Running   0          12s
hostname-59b54b98fd-kv5v4   1/1     Running   0          12s

$ kubectl expose deployment hostname --port=80
service/hostname exposed

$ kubectl run tester --image=nginx
pod/tester created

$ kubectl exec tester -- curl -s hostname.default.svc.cluster.local
hostname-59b54b98fd-kv5v4
$ kubectl exec tester -- curl -s hostname.default.svc.cluster.local
hostname-59b54b98fd-8z6cb
$ kubectl exec tester -- curl -s hostname.default.svc.cluster.local
hostname-59b54b98fd-62rbw

About

A docker image for simple http server which returns $HOSTNAME

Topics

Resources

Stars

Watchers

Forks

Packages