diff options
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_internal_linux.go | 17 | ||||
-rw-r--r-- | libpod/filters/pods.go | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 7754a65c5..b81f3f716 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -1354,6 +1354,14 @@ func (c *Container) makeBindMounts() error { return err } } + } else { + if !c.config.UseImageHosts && c.state.BindMounts["/etc/hosts"] == "" { + newHosts, err := c.generateHosts("/etc/hosts") + if err != nil { + return errors.Wrapf(err, "error creating hosts file for container %s", c.ID()) + } + c.state.BindMounts["/etc/hosts"] = newHosts + } } // SHM is always added when we mount the container @@ -1614,14 +1622,11 @@ func (c *Container) getHosts() string { } if !hasNetNS { // 127.0.1.1 and host's hostname to match Docker - osHostname, err := os.Hostname() - if err != nil { - osHostname = c.Hostname() - } - hosts += fmt.Sprintf("127.0.1.1 %s\n", osHostname) + osHostname, _ := os.Hostname() + hosts += fmt.Sprintf("127.0.1.1 %s %s %s\n", osHostname, c.Hostname(), c.config.Name) } if netNone { - hosts += fmt.Sprintf("127.0.1.1 %s\n", c.Hostname()) + hosts += fmt.Sprintf("127.0.1.1 %s %s\n", c.Hostname(), c.config.Name) } } } diff --git a/libpod/filters/pods.go b/libpod/filters/pods.go index 7d12eefa6..3cd97728f 100644 --- a/libpod/filters/pods.go +++ b/libpod/filters/pods.go @@ -88,7 +88,7 @@ func GeneratePodFilterFunc(filter, filterValue string) ( return match }, nil case "status": - if !util.StringInSlice(filterValue, []string{"stopped", "running", "paused", "exited", "dead", "created"}) { + if !util.StringInSlice(filterValue, []string{"stopped", "running", "paused", "exited", "dead", "created", "degraded"}) { return nil, errors.Errorf("%s is not a valid pod status", filterValue) } return func(p *libpod.Pod) bool { |