Add .containerenv file

This will allow programs to easily identify they are running in a
container

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #533
Approved by: baude
This commit is contained in:
Matthew Heon 2018-03-22 19:11:43 -04:00 committed by Atomic Bot
parent 6cf7ddbcfa
commit 75f9fdf21c

View file

@ -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
}