mirror of
https://github.com/containers/podman.git
synced 2025-06-05 22:31:06 +08:00
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:
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user