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", }...)