Skip to content

Commit fa6ce2e

Browse files
committed
fix: add proper FQDN to toolbox containers
1 parent 9e1cc2a commit fa6ce2e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/cmd/create.go

+13-1
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,20 @@ func createContainer(container, image, release string, showCommandToEnter bool)
409409

410410
createArgs = append(createArgs, xdgRuntimeDirEnv...)
411411

412+
hostname, err := os.Hostname()
413+
containerHostname := ""
414+
if err == nil {
415+
containerHostname = "toolbox" + "." + hostname
416+
logrus.Debugf("using container hostname: %s", containerHostname)
417+
} else {
418+
logrus.Warnf("could not get hostname, failed to deduce container hostname defaulting to plain 'toolbox'")
419+
containerHostname = "toolbox"
420+
}
421+
createArgs = append(createArgs, []string{
422+
"--hostname", containerHostname,
423+
}...)
424+
412425
createArgs = append(createArgs, []string{
413-
"--hostname", "toolbox",
414426
"--ipc", "host",
415427
"--label", "com.github.containers.toolbox=true",
416428
}...)

0 commit comments

Comments
 (0)