Merge pull request #15799 from mheon/fix_2126697
Ensure that a broken OCI spec does not break inspect
This commit is contained in:
commit
4fc18d07a6
|
@ -356,7 +356,9 @@ func (c *Container) specFromState() (*spec.Spec, error) {
|
|||
return nil, fmt.Errorf("reading container config: %w", err)
|
||||
}
|
||||
if err := json.Unmarshal(content, &returnSpec); err != nil {
|
||||
return nil, fmt.Errorf("unmarshalling container config: %w", err)
|
||||
// Malformed spec, just use c.config.Spec instead
|
||||
logrus.Warnf("Error unmarshalling container %s config: %v", c.ID(), err)
|
||||
return c.config.Spec, nil
|
||||
}
|
||||
} else if !os.IsNotExist(err) {
|
||||
// ignore when the file does not exist
|
||||
|
|
Loading…
Reference in New Issue