aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-03-22 19:11:43 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-23 15:22:01 +0000
commit75f9fdf21ca7d2002c226222e6f839e28c4361dd (patch)
tree22d64a9224dc3e9d9c7496582fcbe7f5602d6019 /libpod
parent6cf7ddbcfadc05a66d1efa929d4665ba36abde75 (diff)
downloadpodman-75f9fdf21ca7d2002c226222e6f839e28c4361dd.tar.gz
podman-75f9fdf21ca7d2002c226222e6f839e28c4361dd.tar.bz2
podman-75f9fdf21ca7d2002c226222e6f839e28c4361dd.zip
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
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal.go10
1 files changed, 10 insertions, 0 deletions
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
}