<p>My senerio is in dockfile, read env HOSTNAME and check value to do different work (before ENTRYPOIONT).</p>
<p>But during my work, i found HOSTNAME env is NOT writer by K8S like: <strong>HOSTNAME=09729c381246</strong></p>
<p>so i think the real HOSTNAME is after ENTRYPOIONT run, K8S set the HOSTNAME and POST_NAME from deployment file.</p>
<p><strong>Is there a way to get real HOSTNAME or POST_NAME from dockerfile?</strong></p>
<p>thanks,</p>
<p>-Jim</p>

Jimmy.Wang
<p>No.  The host name is potentially different each time a new container is created from the image, and the default naming scheme will be different in Kubernetes and plain Docker.  There's no way to know at image-build time what the <strong>hostname</strong>(1) eventually will be.</p>
