diff --git a/daemon/oci_linux.go b/daemon/oci_linux.go index 44ac97d1d3..47970593d3 100644 --- a/daemon/oci_linux.go +++ b/daemon/oci_linux.go @@ -176,7 +176,14 @@ func readUserFile(c *container.Container, p string) (io.ReadCloser, error) { if err != nil { return nil, err } - return os.Open(fp) + fh, err := os.Open(fp) + if err != nil { + // This is needed because a nil *os.File is different to a nil + // io.ReadCloser and this causes GetExecUser to not detect that the + // container file is missing. + return nil, err + } + return fh, nil } func getUser(c *container.Container, username string) (uint32, uint32, []uint32, error) {