diff options
author | Sebastiaan van Stijn <thaJeztah@users.noreply.github.com> | 2022-08-24 21:30:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-24 21:30:25 +0200 |
commit | fa2799804c63659326b63fb787b4541aed8dde8c (patch) | |
tree | 83f94f3b1b50023c96d45ac3182fedec41cac148 | |
parent | ce550fa9c2e0f7b85a77e72a9596b2f92f1d0e32 (diff) | |
parent | 92d2e12a4d1f2886dac5d202694c89f628ef2134 (diff) |
Merge pull request #44030 from thaJeztah/fix_inspect
daemon: getInspectData(): skip graphdriver data for snapshotters
-rw-r--r-- | daemon/inspect.go | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/daemon/inspect.go b/daemon/inspect.go index 17331be232..3fc3de2806 100644 --- a/daemon/inspect.go +++ b/daemon/inspect.go @@ -184,6 +184,11 @@ func (daemon *Daemon) getInspectData(container *container.Container) (*types.Con contJSONBase.GraphDriver.Name = container.Driver + if daemon.UsesSnapshotter() { + // Additional information only applies to graphDrivers, so we're done. + return contJSONBase, nil + } + if container.RWLayer == nil { if container.Dead { return contJSONBase, nil @@ -192,17 +197,16 @@ func (daemon *Daemon) getInspectData(container *container.Container) (*types.Con } graphDriverData, err := container.RWLayer.Metadata() - // If container is marked as Dead, the container's graphdriver metadata - // could have been removed, it will cause error if we try to get the metadata, - // we can ignore the error if the container is dead. if err != nil { - if !container.Dead { - return nil, errdefs.System(err) + if container.Dead { + // container is marked as Dead, and its graphDriver metadata may + // have been removed; we can ignore errors. + return contJSONBase, nil } - } else { - contJSONBase.GraphDriver.Data = graphDriverData + return nil, errdefs.System(err) } + contJSONBase.GraphDriver.Data = graphDriverData return contJSONBase, nil } |