From b89e55f0a97f973555074da693de9f56ce55e53f Mon Sep 17 00:00:00 2001 From: Alex Diaz Date: Mon, 5 Dec 2022 17:10:12 -0500 Subject: [PATCH] fix: add proper FQDN to toolbox containers Signed-off-by: Alex Diaz --- src/cmd/create.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/cmd/create.go b/src/cmd/create.go index 73d76a154..8ca1f9513 100644 --- a/src/cmd/create.go +++ b/src/cmd/create.go @@ -409,8 +409,20 @@ func createContainer(container, image, release string, showCommandToEnter bool) createArgs = append(createArgs, xdgRuntimeDirEnv...) + hostname, err := os.Hostname() + containerHostname := "" + if err == nil { + containerHostname = "toolbox" + "." + hostname + logrus.Debugf("using container hostname: %s", containerHostname) + } else { + logrus.Warnf("could not get hostname, failed to deduce container hostname defaulting to plain 'toolbox'") + containerHostname = "toolbox" + } + createArgs = append(createArgs, []string{ + "--hostname", containerHostname, + }...) + createArgs = append(createArgs, []string{ - "--hostname", "toolbox", "--ipc", "host", "--label", "com.github.containers.toolbox=true", }...)