I have some doubts about dnsdomainname
command in docker container when I developed non-root DataStage, in Engine Conductor
tier.
References to Configure container DNS
How can Docker supply each container a hostname
and DNS configuration
without having to build a custom image with the hostname written inside? The trick is to overlay three crucial /etc
files inside the container with virtual files where it can write fresh information.
In container, run:
1 | # mount | grep etc |
Four different options affect container domain name services, please see official documentation for explanation:
-h HOSTNAME
or--hostname=HOSTNAME
--link=CONTAINER_NAME
orID:ALIAS
--dns=IP_ADDRESS
--dns-search=DOMAIN
--dns-opt=OPTION
So what should dnsdomainname
return exactly? for non-root engine docker container, the hostname is is-en-conductor-0.en-cond
, but why sometimes dnsdomainname
return empty but sometimes return en.cond
.
I find the return depends on /etc/hosts
file first non-self-loop IP hostname pair, for example:
1 | 9.30.223.186 is-en-conductor-0.en-cond is-servicesdocker is-xmetadocker |
the dnsdomainname
will return en-cond
, but if change to
1 | 9.30.223.186 is-xmetadocker is-en-conductor-0.en-cond is-servicesdocker |
the command returns empty, and if you run hostname -f
(long host name), it returns is-xmetadocker
.