From 75f9fdf21ca7d2002c226222e6f839e28c4361dd Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Thu, 22 Mar 2018 19:11:43 -0400 Subject: Add .containerenv file This will allow programs to easily identify they are running in a container Signed-off-by: Matthew Heon Closes: #533 Approved by: baude --- libpod/container_internal.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libpod/container_internal.go b/libpod/container_internal.go index e228dd651..d70e5c13b 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -672,6 +672,16 @@ func (c *Container) makeBindMounts() error { c.state.BindMounts["/etc/hostname"] = hostnamePath } + // Make .containerenv + if _, ok := c.state.BindMounts["/.containerenv"]; !ok { + // Empty string for now, but we may consider populating this later + containerenvPath, err := c.writeStringToRundir(".containerenv", "") + if err != nil { + return errors.Wrapf(err, "error creating containerenv file for container %s", c.ID()) + } + c.state.BindMounts["/.containerenv"] = containerenvPath + } + return nil } -- cgit v1.2.3-54-g00ecf