User Tools

Site Tools


docker:assign_a_hostname_to_the_container

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
docker:assign_a_hostname_to_the_container [2020/04/15 18:33] – created peterdocker:assign_a_hostname_to_the_container [2020/05/13 08:27] (current) – removed peter
Line 1: Line 1:
-====== Docker - Assign a hostname to the container ====== 
- 
-The value supplied to the **--hostname** command is set inside **/etc/hostname** and **/etc/hosts** inside the container.  Consequently, it appears in command prompt.  It plays a role in configuring container DNS and can be helpful while in the learning stages of a multi-container setup.  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. 
- 
-<code bash> 
-docker run --hostname=value 
-</code> 
- 
-or 
- 
-<code bash> 
-docker run -h value 
-</code> 
- 
- 
-While **<nowiki>--name</nowiki>** and **<nowiki>--hostname</nowiki>** are both useful for identification of containers, sometimes, it's not about naming the container at all.  Rather, it's about having a container clean up after itself without having to remember to do it yourself. 
  
docker/assign_a_hostname_to_the_container.1586975625.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki