From 82ee58efe74e75a2bb38bde76a8c5c4d52f1647e Mon Sep 17 00:00:00 2001 From: baude Date: Mon, 11 Feb 2019 09:07:34 -0600 Subject: [PATCH] lock and sync container before checking mountpoint when checking for a container's mountpoint, you must lock and sync the container or the result may be "". Fixes: #2304 Signed-off-by: baude --- libpod/kube.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libpod/kube.go b/libpod/kube.go index f34805e399a8..d30b621cf40b 100644 --- a/libpod/kube.go +++ b/libpod/kube.go @@ -421,7 +421,13 @@ func generateKubeSecurityContext(c *Container) (*v1.SecurityContext, error) { } if c.User() != "" { - // It is *possible* that + if !c.batched { + c.lock.Lock() + defer c.lock.Unlock() + } + if err := c.syncContainer(); err != nil { + return nil, errors.Wrapf(err, "unable to sync container during YAML generation") + } logrus.Debugf("Looking in container for user: %s", c.User()) u, err := lookup.GetUser(c.state.Mountpoint, c.User()) if err != nil {