User Tools

Site Tools


docker:containers:assign_a_hostname_to_the_container

Docker - Containers - Assign a hostname to the container

docker run --hostname=value

or

docker run -h value

NOTE: --name and --hostname are both useful for identification of containers.

The value supplied to the –hostname command is set inside /etc/hostname and /etc/hosts inside the container.

Consequently, it appears in the command prompt of the container.

It plays a role in configuring container DNS.

It is not easy to access from outside the container, but it will appear in the container's log files, and when those files are written to a volume independent of the host, it can make it easier to identify the container.

docker/containers/assign_a_hostname_to_the_container.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki