Merge pull request #192 from w9n/fix_empty_container_config

allow ImageInspect.Config to be nil when parsing
This commit is contained in:
Justin Cormack 2018-01-04 11:27:42 +00:00 committed by GitHub
commit b5615a3714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -702,9 +702,9 @@ func ConfigInspectToOCI(yaml *Image, inspect types.ImageInspect, idMap map[strin
oci := specs.Spec{}
runtime := Runtime{}
var inspectConfig container.Config
inspectConfig := &container.Config{}
if inspect.Config != nil {
inspectConfig = *inspect.Config
inspectConfig = inspect.Config
}
// look for org.mobyproject.config label
@ -721,7 +721,7 @@ func ConfigInspectToOCI(yaml *Image, inspect types.ImageInspect, idMap map[strin
// command, env and cwd can be taken from image, as they are commonly specified in Dockerfile
// TODO we could handle entrypoint and cmd independently more like Docker
inspectCommand := append(inspectConfig.Entrypoint, inspect.Config.Cmd...)
inspectCommand := append(inspectConfig.Entrypoint, inspectConfig.Cmd...)
args := assignStrings3(inspectCommand, label.Command, yaml.Command)
env := assignStrings3(inspectConfig.Env, label.Env, yaml.Env)