When using Ubuntu in docker , there is no way to modify the hostname; each time to connect to ubuntu, hostname is a random string ....
Use -h
option :
docker run -h custom.hostname -ti ubuntu bash
root@custom:/# hostname
custom.hostname
See docker run documentation for more details
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.