dive icon indicating copy to clipboard operation
dive copied to clipboard

How to see all layers?

Open caleb15 opened this issue 4 years ago • 2 comments
trafficstars

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)

caleb15 avatar Nov 25 '20 02:11 caleb15

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?

mjlescano avatar Feb 04 '21 22:02 mjlescano

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

nguyening avatar Oct 22 '21 17:10 nguyening

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

wagoodman avatar Jul 06 '23 15:07 wagoodman