wagoodman / dive

A tool for exploring each layer in a docker image
MIT License
46.25k stars 1.77k forks source link

How to see all layers? #328

Closed caleb15 closed 1 year ago

caleb15 commented 3 years ago

This is probably just me missing something obvious but with a image that has so many layers that it doesn't fit in the screen, the last few layers are not shown and I don't know how to get to them. I tried pressing the down arrow and page down and nothing happened.

image

image

As you can see in the image above there are more layers not displayed. Note that the image immediately above shows layers in reverse order (first layer at bottom, last layer on top)

mjlescano commented 3 years ago

Hi! I'm having the same problem, maybe it is worth noting that my image is on a private repo and uses a multi stage build?

nguyening commented 3 years ago
diff --git a/runtime/ui/view/layer.go b/runtime/ui/view/layer.go
index c1f9d0c..b3ffc91 100644
--- a/runtime/ui/view/layer.go
+++ b/runtime/ui/view/layer.go
@@ -2,6 +2,7 @@ package view

 import (
    "fmt"
+   "strings"
    "github.com/awesome-gocui/gocui"
    "github.com/sirupsen/logrus"
    "github.com/spf13/viper"
@@ -324,6 +325,9 @@ func (v *Layer) Render() error {
                layerStr = fmt.Sprintf("%-4d", layer.Index)
            } else {
                layerStr = layer.String()
+               if i := strings.Index(layerStr, "\n"); i != -1 {
+                   layerStr = layerStr[:i]
+               }
            }

            compareBar := v.renderCompareBar(idx)

May or may not be your problem: I have observed this in Dockerfiles with heredocs.

The JSON dumped by -j shows all the layers I expect but in the GUI having any layers with a multiline string ends up hiding layers

Screen Shot 2021-10-22 at 1 18 30 PM

the RUN echo 1 layer is missing and if I try to cursor down I'm either prevented, or in this case dive just exits.

If I apply the patch above it looks like this:

Screen Shot 2021-10-22 at 1 20 23 PM

wagoodman commented 1 year ago

Fixed in https://github.com/wagoodman/dive/pull/399