When to use --hostname in docker?

前端 未结 3 1780
心在旅途
心在旅途 2020-12-08 00:01

Is --hostname like a domain name system in docker container environment that can replace --ip when referring to other container?

3条回答
  •  悲哀的现实
    2020-12-08 00:24

    --hostname is a parameter which can be given along with docker run command which will set the specified name as containers hostname whereas --ip is parameter to set specific ip address(ipv4) to that particular container.

    docker run --hostname test --ip 10.1.2.3 ubuntu:14.04 
    

    The following command will create a docker container with base image as ubuntu-14.04 with hostname as test and container ip address as 10.1.2.3

提交回复
热议问题