Expose RootFS in image inspect

Fixes #20451

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 14dc4a7158a141b5c13aa63231e467f0c3235850
Component: engine
This commit is contained in:
Tonis Tiigi
2016-03-22 13:49:30 -07:00
parent 02220a45c4
commit 296caafbd2
5 changed files with 45 additions and 2 deletions
+1
View File
@@ -1164,6 +1164,7 @@ func (daemon *Daemon) LookupImage(name string) (*types.ImageInspect, error) {
Os: img.OS,
Size: size,
VirtualSize: size, // TODO: field unused, deprecate
RootFS: rootFSToAPIType(img.RootFS),
}
imageInspect.GraphDriver.Name = daemon.GraphDriverName()
+11
View File
@@ -1092,3 +1092,14 @@ func (daemon *Daemon) stats(c *container.Container) (*types.StatsJSON, error) {
func (daemon *Daemon) setDefaultIsolation() error {
return nil
}
func rootFSToAPIType(rootfs *image.RootFS) types.RootFS {
var layers []string
for _, l := range rootfs.DiffIDs {
layers = append(layers, l.String())
}
return types.RootFS{
Type: rootfs.Type,
Layers: layers,
}
}
@@ -453,3 +453,15 @@ func (daemon *Daemon) setDefaultIsolation() error {
logrus.Infof("Windows default isolation mode: %s", daemon.defaultIsolation)
return nil
}
func rootFSToAPIType(rootfs *image.RootFS) types.RootFS {
var layers []string
for _, l := range rootfs.DiffIDs {
layers = append(layers, l.String())
}
return types.RootFS{
Type: rootfs.Type,
Layers: layers,
BaseLayer: rootfs.BaseLayer,
}
}