aboutsummaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index e0411e028..414def120 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -901,8 +901,8 @@ func (c *Container) generateHosts() (string, error) {
if len(c.config.HostAdd) > 0 {
for _, host := range c.config.HostAdd {
// the host format has already been verified at this point
- fields := strings.Split(host, ":")
- hosts += fmt.Sprintf("%s %s\n", fields[0], fields[1])
+ fields := strings.SplitN(host, ":", 2)
+ hosts += fmt.Sprintf("%s %s\n", fields[1], fields[0])
}
}
return c.writeStringToRundir("hosts", hosts)