summaryrefslogtreecommitdiff
path: root/libpod/container_api.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-01-29 12:22:23 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2018-01-30 15:21:10 +0000
commitf02d72fb760daeb8d1d0e3c4dd0031afa518729e (patch)
treec6e87a8d01f5daa68d42e08bdbb271a2cd1126f9 /libpod/container_api.go
parent4cb33035ce82d4eebc20a01abab20828be802f4d (diff)
downloadpodman-f02d72fb760daeb8d1d0e3c4dd0031afa518729e.tar.gz
podman-f02d72fb760daeb8d1d0e3c4dd0031afa518729e.tar.bz2
podman-f02d72fb760daeb8d1d0e3c4dd0031afa518729e.zip
libpod/container_api: Set hostname in ENV
The container's hostname should be set as an environment variable for the container. Signed-off-by: baude <bbaude@redhat.com> Closes: #273 Approved by: baude
Diffstat (limited to 'libpod/container_api.go')
-rw-r--r--libpod/container_api.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go
index cd3485880..c0ccdc212 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -268,6 +268,9 @@ func (c *Container) Init() (err error) {
c.runningSpec.Annotations[crioAnnotations.Created] = c.config.CreatedTime.Format(time.RFC3339Nano)
c.runningSpec.Annotations["org.opencontainers.image.stopSignal"] = fmt.Sprintf("%d", c.config.StopSignal)
+ // Set the hostname in the env variables
+ c.runningSpec.Process.Env = append(c.runningSpec.Process.Env, fmt.Sprintf("HOSTNAME=%s", c.config.Spec.Hostname))
+
fileJSON, err := json.Marshal(c.runningSpec)
if err != nil {
return errors.Wrapf(err, "error exporting runtime spec for container %s to JSON", c.ID())