Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (2.3k points)

Does --hostname act as a domain name system? When referring to other containers can it replace --ip?  

closed

1 Answer

0 votes
by (6.9k points)
selected by
 
Best answer

This flag, --hostname is used to change the host name of you container, its used when you run your container. 

Example :

$ docker run --hostname demo nginx

 This does not change the container's DNS outside docker and it also does  not provide any network isolation, so you cannot connect to the container using the hostname.

Where as the --ip flag is used to assign a specific ip to your container .

Example :

$ docker run --ip 10.0.0.2 nginx

Hope this helped :)


Also it's never to late to get certified in docker and devops. if you wish to learn more about docker refer to Docker training course.

Browse Categories

...