diff options
author | Matthew Heon <mheon@redhat.com> | 2018-05-24 10:41:56 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-05-25 15:32:47 +0000 |
commit | de13777e71c73cca85c1a69d69da27299be9a269 (patch) | |
tree | de8ca5ee39762d8ba2eeacd215921a91745859f3 /libpod/container_commit.go | |
parent | c8b72e57a75262c0edeea839e9e34bb0c3e03d13 (diff) | |
download | podman-de13777e71c73cca85c1a69d69da27299be9a269.tar.gz podman-de13777e71c73cca85c1a69d69da27299be9a269.tar.bz2 podman-de13777e71c73cca85c1a69d69da27299be9a269.zip |
Make references to the Process part of Spec conditional
The OCI runtime spec does not require Process to be passed (IE,
it can be nil). Make most of our references to it conditional on
it existing.
Signed-off-by: Matthew Heon <mheon@redhat.com>
Closes: #828
Approved by: mheon
Diffstat (limited to 'libpod/container_commit.go')
-rw-r--r-- | libpod/container_commit.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libpod/container_commit.go b/libpod/container_commit.go index 9aa5f407f..8cb04ec1a 100644 --- a/libpod/container_commit.go +++ b/libpod/container_commit.go @@ -84,9 +84,13 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai importBuilder.SetCmd(c.config.Command) // Env - for _, e := range c.config.Spec.Process.Env { - splitEnv := strings.Split(e, "=") - importBuilder.SetEnv(splitEnv[0], splitEnv[1]) + // TODO - this includes all the default environment vars as well + // Should we store the ENV we actually want in the spec separately? + if c.config.Spec.Process != nil { + for _, e := range c.config.Spec.Process.Env { + splitEnv := strings.Split(e, "=") + importBuilder.SetEnv(splitEnv[0], splitEnv[1]) + } } // Expose ports for _, p := range c.config.PortMappings { |