更新时间:2022-06-13 00:44:52
您可以将主机名作为环境变量传递。您也可以挂载/ etc,以便可以使用/ etc / hostname。但是我同意Vitaly,这不是容器IMO的预期用例。
You can pass in the hostname as an environment variable. You could also mount /etc so you can cat /etc/hostname. But I agree with Vitaly, this isn't the intended use case for containers IMO.