mirror of
https://github.com/containers/podman.git
synced 2025-08-06 03:19:52 +08:00
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
This commit is contained in:
@ -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())
|
||||
|
Reference in New Issue
Block a user