Skip to content

Commit

Permalink
Add .containerenv file
Browse files Browse the repository at this point in the history
This will allow programs to easily identify they are running in a
container

Signed-off-by: Matthew Heon <[email protected]>

Closes: #533
Approved by: baude
  • Loading branch information
mheon authored and rh-atomic-bot committed Mar 23, 2018
1 parent 6cf7ddb commit 75f9fdf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libpod/container_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 75f9fdf

Please sign in to comment.