mirror of
https://github.com/containers/podman.git
synced 2025-07-04 10:10:32 +08:00
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
This commit is contained in:
@ -84,9 +84,13 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai
|
|||||||
importBuilder.SetCmd(c.config.Command)
|
importBuilder.SetCmd(c.config.Command)
|
||||||
|
|
||||||
// Env
|
// Env
|
||||||
for _, e := range c.config.Spec.Process.Env {
|
// TODO - this includes all the default environment vars as well
|
||||||
splitEnv := strings.Split(e, "=")
|
// Should we store the ENV we actually want in the spec separately?
|
||||||
importBuilder.SetEnv(splitEnv[0], splitEnv[1])
|
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
|
// Expose ports
|
||||||
for _, p := range c.config.PortMappings {
|
for _, p := range c.config.PortMappings {
|
||||||
|
@ -13,7 +13,11 @@ func (c *Container) getContainerInspectData(size bool, driverData *inspect.Data)
|
|||||||
runtimeInfo := c.state
|
runtimeInfo := c.state
|
||||||
spec := c.config.Spec
|
spec := c.config.Spec
|
||||||
|
|
||||||
args := config.Spec.Process.Args
|
// Process is allowed to be nil in the spec
|
||||||
|
args := []string{}
|
||||||
|
if config.Spec.Process != nil {
|
||||||
|
args = config.Spec.Process.Args
|
||||||
|
}
|
||||||
var path string
|
var path string
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
path = args[0]
|
path = args[0]
|
||||||
|
Reference in New Issue
Block a user