diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-10-07 13:29:04 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-07 13:29:04 -0400 |
commit | 173e3c2faa74e5ef1b941338c06e5dd7dca68ac2 (patch) | |
tree | ace2821ff5c5ef5044d5a8b796f39bcd53a8e3d0 /libpod/container_internal_linux.go | |
parent | ce93ab354234c989c52bdbf87166e117e7c97fce (diff) | |
parent | 3ae47f7d2b9328ff47dc5702d834ae9ee296a27b (diff) | |
download | podman-173e3c2faa74e5ef1b941338c06e5dd7dca68ac2.tar.gz podman-173e3c2faa74e5ef1b941338c06e5dd7dca68ac2.tar.bz2 podman-173e3c2faa74e5ef1b941338c06e5dd7dca68ac2.zip |
Merge pull request #7937 from rhatdan/size
Populate /etc/hosts file when run in a user namespace
Diffstat (limited to 'libpod/container_internal_linux.go')
-rw-r--r-- | libpod/container_internal_linux.go | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 894982973..41cc80789 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -1543,10 +1543,7 @@ func (c *Container) getHosts() string { // When using slirp4netns, the interface gets a static IP hosts += fmt.Sprintf("# used by slirp4netns\n%s\t%s %s\n", "10.0.2.100", c.Hostname(), c.Config().Name) } - if len(c.state.NetworkStatus) > 0 && len(c.state.NetworkStatus[0].IPs) > 0 { - ipAddress := strings.Split(c.state.NetworkStatus[0].IPs[0].Address.String(), "/")[0] - hosts += fmt.Sprintf("%s\t%s %s\n", ipAddress, c.Hostname(), c.Config().Name) - } + hosts += c.cniHosts() return hosts } |