Code Monkey home page Code Monkey logo

dive's Introduction

dive's People

Contributors

abitrolly avatar akramfares avatar akshaychhajed avatar chenrui333 avatar chriscinelli avatar dependabot[bot] avatar dosisod avatar gliptak avatar iwataka avatar luhring avatar lutzky avatar markruler avatar muesli avatar olegtarassov avatar orhun avatar orihomie avatar renenyffenegger avatar sarke avatar slash-cyberpunk avatar slashdevsda avatar stigok avatar supersandro2000 avatar tbroyer avatar theden avatar thedevsaddam avatar tklauser avatar trungnn avatar wagoodman avatar willmurphyscode avatar yurenchen000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dive's Issues

Integrate with Clair

Dive would not only show the tree, layer, and stats but also run Clair in the background and show the results in the stats pane when the scan has been completed.

Client API version is newer than the supported Daemon version

Dive is an very useful tool, and hope to support the offline analysis.

(Eg: add a parameter alwayspullimage: True/False) πŸ˜ƒ

 ⚑ root@k8s ξ‚° /home/ubuntu ξ‚° docker images
REPOSITORY               TAG                 IMAGE ID            CREATED             SIZE
busybox                  latest              59788edf1f3e        3 weeks ago         1.154 MB
alpine                   3.8                 196d12cf6ab1        6 weeks ago         4.413 MB
k8s.gcr.io/pause-amd64   3.1                 da86e6ba6ca1        10 months ago       742.5 kB
k8s.gcr.io/pause         3.1                 da86e6ba6ca1        10 months ago       742.5 kB
 ⚑ root@k8s ξ‚° /home/ubuntu ξ‚° dive --version
dive 0.0.8
 ⚑ root@k8s ξ‚° /home/ubuntu ξ‚° dive busybox:latest
Analyzing Image
Pulling repository docker.io/library/busybox
Error while pulling image: Get https://index.docker.io/v1/repositories/library/busybox/images: dial tcp: lookup index.docker.io on 192.168.1.100:53: server misbehaving
  Fetching metadata...
  Fetching image...panic: Error response from daemon: client is newer than server (client API version: 1.26, server API version: 1.24)

goroutine 1 [running]:
github.com/wagoodman/dive/image.check(0x9d74c0, 0xc4203d4120)
        /home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:28 +0x4a
github.com/wagoodman/dive/image.saveImage(0x7ffdc5c4d7b5, 0xe, 0x0, 0x0, 0x0, 0x0)
        /home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:357 +0x3cd
github.com/wagoodman/dive/image.InitializeData(0x7ffdc5c4d7b5, 0xe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:216 +0x218
github.com/wagoodman/dive/cmd.analyze(0xc49040, 0xc4202abbe0, 0x1, 0x1)
        /home/wagoodman/go/src/github.com/wagoodman/dive/cmd/analyze.go:36 +0x119
github.com/spf13/cobra.(*Command).execute(0xc49040, 0xc42000c090, 0x1, 0x1, 0xc49040, 0xc42000c090)
        /home/wagoodman/go/src/github.com/spf13/cobra/command.go:766 +0x2c1
github.com/spf13/cobra.(*Command).ExecuteC(0xc49040, 0x2, 0x7f1e99c02000, 0x0)
        /home/wagoodman/go/src/github.com/spf13/cobra/command.go:852 +0x30a
github.com/spf13/cobra.(*Command).Execute(0xc49040, 0xc4201c9f78, 0xc4201c9f58)
        /home/wagoodman/go/src/github.com/spf13/cobra/command.go:800 +0x2b
github.com/wagoodman/dive/cmd.Execute()
        /home/wagoodman/go/src/github.com/wagoodman/dive/cmd/root.go:29 +0x2d
main.main()
        /home/wagoodman/go/src/github.com/wagoodman/dive/main.go:38 +0xad
 ✘ ⚑ root@k8s ξ‚° /home/ubuntu ξ‚°

Debian repo

Hi there, any plans with pushing this awesome piece of software into Debian repo? Or running your own?

crashes on image analysis

on a mac, using brew to install dive wagoodman/dive/dive: stable 0.0.5 . analyzing a very large centos image.

  Fetching image config...
  Building tree...
  Analyzing layers...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x139b3b6]

goroutine 1 [running]:
github.com/jroimartin/gocui.(*View).Clear(0x0)
	/home/wagoodman/go/src/github.com/jroimartin/gocui/view.go:392 +0x26
github.com/wagoodman/dive/ui.(*DetailsView).Render.func1(0xc467340000, 0x1, 0xc471d91858)
	/home/wagoodman/go/src/github.com/wagoodman/dive/ui/detailsview.go:119 +0x87
github.com/jroimartin/gocui.(*Gui).consumeevents(0xc467340000, 0xc471d919f0, 0x0)
	/home/wagoodman/go/src/github.com/jroimartin/gocui/gui.go:399 +0x17c
github.com/jroimartin/gocui.(*Gui).MainLoop(0xc467340000, 0x0, 0x0)
	/home/wagoodman/go/src/github.com/jroimartin/gocui/gui.go:381 +0x204
github.com/wagoodman/dive/ui.Run(0xc4203903c0, 0x39, 0x39, 0xc46a254400, 0x39, 0x40, 0x3fe14a3d82e9cd53, 0xc474fce000, 0x823e, 0x9800)
	/home/wagoodman/go/src/github.com/wagoodman/dive/ui/ui.go:330 +0x94c
github.com/wagoodman/dive/cmd.analyze(0x183cac0, 0xc42027bc60, 0x1, 0x1)
	/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/analyze.go:22 +0x166
github.com/spf13/cobra.(*Command).execute(0x183cac0, 0xc42000a070, 0x1, 0x1, 0x183cac0, 0xc42000a070)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:766 +0x2c1
github.com/spf13/cobra.(*Command).ExecuteC(0x183cac0, 0x1, 0x1, 0x0)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:852 +0x30a
github.com/spf13/cobra.(*Command).Execute(0x183cac0, 0xc42002a0b8, 0x0)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:800 +0x2b
github.com/wagoodman/dive/cmd.Execute()
	/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/root.go:28 +0x2d
main.main()
	/home/wagoodman/go/src/github.com/wagoodman/dive/main.go:34 +0x20

Running on windows: "panic: exec: "docker": executable file not found in $PATH"

HI,

I am trying to run dive using the provided instructions for windows:

docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock wagoodman/dive:latest <some:image>

This is the output:

Analyzing Image
panic: exec: "docker": executable file not found in $PATH

goroutine 1 [running]:
github.com/wagoodman/dive/utils.DiscoverDockerVersion(0x94e220, 0x0)
        /home/wagoodman/go/src/github.com/wagoodman/dive/utils/docker.go:42 +0x18d
github.com/wagoodman/dive/image.InitializeData(0x7ffcea2b3f34, 0x4f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:202 +0xf2
github.com/wagoodman/dive/cmd.analyze(0xc651a0, 0xc4202b1be0, 0x1, 0x1)
        /home/wagoodman/go/src/github.com/wagoodman/dive/cmd/analyze.go:36 +0x119
github.com/spf13/cobra.(*Command).execute(0xc651a0, 0xc420094010, 0x1, 0x1, 0xc651a0, 0xc420094010)
        /home/wagoodman/go/src/github.com/spf13/cobra/command.go:766 +0x2c1
github.com/spf13/cobra.(*Command).ExecuteC(0xc651a0, 0x2, 0x7f88f39ef6c8, 0x0)
        /home/wagoodman/go/src/github.com/spf13/cobra/command.go:852 +0x30a
github.com/spf13/cobra.(*Command).Execute(0xc651a0, 0xc4201cdf78, 0xc4201cdf58)
        /home/wagoodman/go/src/github.com/spf13/cobra/command.go:800 +0x2b
github.com/wagoodman/dive/cmd.Execute()
        /home/wagoodman/go/src/github.com/wagoodman/dive/cmd/root.go:30 +0x2d
main.main()
        /home/wagoodman/go/src/github.com/wagoodman/dive/main.go:38 +0xad

Is there a workaround for windows?

dive fails in main.go

Hello

Ubuntu
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=17.04
DISTRIB_CODENAME=zesty
DISTRIB_DESCRIPTION="Ubuntu 17.04"

I have a big image of nearly 3 GB, it is a Windows freeware + wine + winetricks dotnet40 and some more things

The Dockerfile is here
https://github.com/k3ck3c/docker_captvty/blob/master/Dockerfile

$ dive k3ck3c/captvty
Analyzing Image
Fetching metadata...
Fetching image... [========================================>] 853 % (23883187200/2799904704)panic: (*logrus.Entry) (0x9622c0,0xc42030c8a0)

goroutine 1 [running]:
github.com/sirupsen/logrus.Entry.log(0xc42008c1e0, 0xc420300a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/wagoodman/go/src/github.com/sirupsen/logrus/entry.go:138 +0x2d2
github.com/sirupsen/logrus.(*Entry).Panic(0xc42030c840, 0xc4201cb418, 0x1, 0x1)
/home/wagoodman/go/src/github.com/sirupsen/logrus/entry.go:206 +0xb8
github.com/sirupsen/logrus.(*Logger).Panic(0xc42008c1e0, 0xc4201cb418, 0x1, 0x1)
/home/wagoodman/go/src/github.com/sirupsen/logrus/logger.go:245 +0x6d
github.com/sirupsen/logrus.Panic(0xc4201cb418, 0x1, 0x1)
/home/wagoodman/go/src/github.com/sirupsen/logrus/exported.go:112 +0x4b
github.com/wagoodman/dive/image.saveImage(0x7ffd3590d29f, 0xe, 0x0, 0x0, 0x0, 0x0)
/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:394 +0x7f9
github.com/wagoodman/dive/image.InitializeData(0x7ffd3590d29f, 0xe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:216 +0x218
github.com/wagoodman/dive/cmd.analyze(0xc49040, 0xc4202adbe0, 0x1, 0x1)
/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/analyze.go:36 +0x119
github.com/spf13/cobra.(*Command).execute(0xc49040, 0xc42000c090, 0x1, 0x1, 0xc49040, 0xc42000c090)
/home/wagoodman/go/src/github.com/spf13/cobra/command.go:766 +0x2c1
github.com/spf13/cobra.(*Command).ExecuteC(0xc49040, 0x2, 0x7f6a6a6e6000, 0x0)
/home/wagoodman/go/src/github.com/spf13/cobra/command.go:852 +0x30a
github.com/spf13/cobra.(*Command).Execute(0xc49040, 0xc4201cbf78, 0xc4201cbf58)
/home/wagoodman/go/src/github.com/spf13/cobra/command.go:800 +0x2b
github.com/wagoodman/dive/cmd.Execute()
/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/root.go:29 +0x2d
main.main()
/home/wagoodman/go/src/github.com/wagoodman/dive/main.go:38 +0xad
$

Strangely a similar docker image works fine, the V3 of captvty needs dotnet45 instead of dotnet40

$ dive k3ck3c/captvty_v3_1
Analyzing Image
Fetching metadata...
Fetching image... [========================================>] 100 % (1773129474/1773129474)
Discovering layers... Done!
β”œβ”€ d9ae5c1d4ac6bbd : [========================================>] 100 % (1391/1391)
β”œβ”€ c0f54c265c37cfb : [========================================>] 100 % (0/0)
β”œβ”€ bc3ec266020bec7 : [========================================>] 100 % (0/0)
β”œβ”€ b1e009a6319c746 : [========================================>] 100 % (11887/11887)
β”œβ”€ b1d1ef38fb95e3a : [========================================>] 100 % (28053/28053)
β”œβ”€ af1698304b91f01 : [========================================>] 100 % (406/406)
β”œβ”€ aa8bc6812fde7c4 : [========================================>] 100 % (2/2)
β”œβ”€ a1291ad504ea07a : [========================================>] 100 % (411/411)
β”œβ”€ 93f482e26b90949 : [========================================>] 100 % (109/109)
β”œβ”€ 8ca9149dc6380dd : [========================================>] 100 % (1417/1417)
β”œβ”€ 847197a4314af40 : [========================================>] 100 % (91/91)
β”œβ”€ 77a9ca4ab4bf912 : [========================================>] 100 % (27/27)
β”œβ”€ 7635b529d1a8393 : [========================================>] 100 % (459/459)
β”œβ”€ 6cf6f9e81ab6e22 : [========================================>] 100 % (2700/2700)
β”œβ”€ 6caf6ffc40ea242 : [========================================>] 100 % (0/0)
β”œβ”€ 5e17bbbd3b0b9aa : [========================================>] 100 % (0/0)
β”œβ”€ 5d68c61bc5a325b : [========================================>] 100 % (8022/8022)
β”œβ”€ 5b68def4cd8a4d6 : [========================================>] 100 % (21/21)
β”œβ”€ 4df713f6b293fe7 : [========================================>] 100 % (1118/1118)
β”œβ”€ 45c72127698e9ca : [========================================>] 100 % (65/65)
β”œβ”€ 4320f0f8b4d99d7 : [========================================>] 100 % (243/243)
β”œβ”€ 3d23ed2956a6bd6 : [========================================>] 100 % (27/27)
β”œβ”€ 3c592c31236d218 : [========================================>] 100 % (3/3)
β”œβ”€ 342f6081907bb97 : [========================================>] 100 % (6/6)
β”œβ”€ 296a0569b4ccc98 : [========================================>] 100 % (66/66)
β”œβ”€ 27fc70269f0ce32 : [========================================>] 100 % (22/22)
β”œβ”€ 20e995179a014c0 : [========================================>] 100 % (25147/25147)
β”œβ”€ 13394172ac14e25 : [========================================>] 100 % (19/19)
β”œβ”€ 08859828a9e2224 : [========================================>] 100 % (89/89)
β”œβ”€ 05eeb36077397ff : [========================================>] 100 % (2257/2257)
Fetching image config...
Building tree...
Analyzing layers...
$

The Dockerfile of Captvty V3

FROM ubuntu:16.04
ENV DEBIAN_FRONTEND noninteractive
ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR:en
ENV LC_ALL fr_FR.UTF-8

activate i386 arch for Wine and install stuff we need

RUN locale-gen fr_FR.UTF-8 &&
dpkg --add-architecture i386 &&
apt-get update &&
BUILD_PACKAGES='wget software-properties-common unzip apt-transport-https openssh-server xauth cabextract winbind squashfs-tools pulseaudio x11-apps xfce4 cups joe xfce4-terminal xvfb socat x11vnc' &&
apt-get -qy upgrade && apt-get -qy install $BUILD_PACKAGES &&
AUTO_ADDED_PACKAGES=apt-mark showauto && \
# install latest Wine
wget -qO- https://dl.winehq.org/wine-builds/Release.key | apt-key add - &&
apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/ &&
apt-get update && apt-get -qy install --no-install-recommends winehq-devel && \

# make sshd work and enable X11 forwarding
# create our user for Wine

useradd -d /home/gg -m -s /bin/bash gg &&
echo gg:gg | chpasswd && \
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks -O /tmp/winetricks &&
chmod +x /tmp/winetricks &&
echo $AUTO_ADDED_PACKAGES &&
sleep 11
USER gg
ENV WINEDEBUG=-all WINEPREFIX=/home/gg/.wine WINEARCH=win32
RUN winecfg &&
xvfb-run -a /tmp/winetricks -q --unattended dotnet45 corefonts comctl32 gdiplus vcrun2010 ie8
USER root
# cleaning up
RUN apt-get autoremove -y --purge software-properties-common &&
apt-get autoremove -y --purge &&
apt-get remove --purge -y software-properties-common apt-transport-https openssh-server xauth cabextract winbind squashfs-tools pulseaudio x11-apps xfce4 cups joe xfce4-terminal xvfb socat x11vnc &&
apt-get clean -y &&
rm -rf /home/wine/.cache &&
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /tmp/inetricks
USER gg
RUN wget -q -O- http://v3.captvty.fr/ | egrep -o '//.+?.zip' | sed 's////http:///' | xargs wget -O /tmp/v3Captvty.zip &&
ls -alrt /tmp/v3Capzip && unzip -d ~/Captvtyv3 /tmp/v3Captvty.zip && rm /tmp/v3Captvty.zip
USER root
RUN apt-get remove --purge -y wget &&
apt-get clean -y &&
apt-get autoremove -y &&
rm -rf /home/wine/.cache &&
rm -rf /var/lib/apt/lists/
/tmp/* /var/tmp/*
USER gg
CMD wine /home/gg/Captvtyv3/Captvty.exe

You can get Captvty.exe from
http://captvty.fr/

and the V3 of Captvty
from
http://v3.captvty.fr/

Thanks for your work!

UUID argument mismatch

Ran an into an issue when doing go get with 1.11.1 and GO111MODULE=on

../go/pkg/mod/github.com/wagoodman/[email protected]/line.go:18:16: not enough arguments in call to uuid.Must

have (uuid.UUID)
want (uuid.UUID, error)

# [github.com/wagoodman/dive/filetree](https://github.com/wagoodman/dive/filetree)

../go/pkg/mod/github.com/wagoodman/[email protected]/filetree/tree.go:37:21: not enough arguments in call to uuid.Must

have (uuid.UUID)
want (uuid.UUID, error)

Make hidden diff types configurable

I would like to add a configuration parameter to dive so that certain diff types in the layer contents panel are hidden by default. The configuration would look like this then:

hidden-diff-types:
    - added
    - removed
    - changed
    - unchanged

NIL pointer on analyze

dive bytesized/appbox-plex:latest
Analyzing Image
latest: Pulling from bytesized/appbox-plex
d54efb8db41d: Pull complete 
f8b845f45a87: Pull complete 
e8db7bf7c39f: Pull complete 
9654c40e9079: Pull complete 
6d9ef359eaaa: Pull complete 
a3ed95caeb02: Pull complete 
f9d05c3c96e7: Pull complete 
0befd19b3f19: Pull complete 
75605fb17320: Pull complete 
68f10b475aab: Pull complete 
dc416005b484: Pull complete 
Digest: sha256:f0e5a1c7128f9a3fa4336cc039d3f10aae457aa11328bfbaa16b469a9c3f7897
Status: Downloaded newer image for bytesized/appbox-plex:latest
  Fetching metadata...
  Fetching image... [========================================>] 100 % (516202464/516202464)
  Discovering layers... Done!
    β”œβ”€ ee627b143e77ba6 : [========================================>] 100 % (8022/8022)
    β”œβ”€ e4d872096c2322b : [========================================>] 100 % (33/33)
    β”œβ”€ cc22c3016e1d554 : [========================================>] 100 % (20/20)
    β”œβ”€ a772287b7f24913 : [========================================>] 100 % (6989/6989)
    β”œβ”€ 965173cb42b3d95 : [========================================>] 100 % (4/4)
    β”œβ”€ 92cd60cf0a884b8 : [========================================>] 100 % (3/3)
    β”œβ”€ 7a5560e76400a14 : [========================================>] 100 % (4/4)
    β”œβ”€ 2b02ab7245719b5 : [========================================>] 100 % (4485/4485)
    β”œβ”€ 24425e305589220 : [========================================>] 100 % (21/21)
    β”œβ”€ 22635eedd439f85 : [========================================>] 100 % (3/3)
    β”œβ”€ 1a713ee756ffbf0 : [========================================>] 100 % (0/0)
  Fetching image config...
  Building tree...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x78801c]

goroutine 1 [running]:
github.com/wagoodman/dive/image.InitializeData(0x7ffcc748d887, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:312 +0xe3c
github.com/wagoodman/dive/cmd.analyze(0xc46fe0, 0xc4202bdbd0, 0x1, 0x1)
	/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/analyze.go:21 +0xe5
github.com/spf13/cobra.(*Command).execute(0xc46fe0, 0xc42000c070, 0x1, 0x1, 0xc46fe0, 0xc42000c070)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:766 +0x2c1
github.com/spf13/cobra.(*Command).ExecuteC(0xc46fe0, 0x1, 0x1, 0x0)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:852 +0x30a
github.com/spf13/cobra.(*Command).Execute(0xc46fe0, 0xc42002c178, 0x0)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:800 +0x2b
github.com/wagoodman/dive/cmd.Execute()
	/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/root.go:28 +0x2d
main.main()
	/home/wagoodman/go/src/github.com/wagoodman/dive/main.go:34 +0x20

running in container: failed to detect docker API version

Sorry, if I have misinterpreted the docs (also I skimmed through the issues), but I think the bottom docker run command should work

$ docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/bin/docker wagoodman/dive:latest --version
dive 0.2.0

$ lsb_release -a
\No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.5 (stretch)
Release: 9.5
Codename: stretch

$ /usr/bin/docker version
Client:
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:48:46 2018
OS/Arch: linux/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:16:44 2018
OS/Arch: linux/amd64
Experimental: false

$ docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/bin/docker wagoodman/dive:latest alpine:3.8
Analyzing Image
panic: exit status 127

goroutine 1 [running]:
github.com/wagoodman/dive/utils.DiscoverDockerVersion(0x94e220, 0x0)
/home/wagoodman/go/src/github.com/wagoodman/dive/utils/docker.go:42 +0x18d
github.com/wagoodman/dive/image.InitializeData(0x7fff6e84df79, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:202 +0xf2
github.com/wagoodman/dive/cmd.analyze(0xc651a0, 0xc4202c7be0, 0x1, 0x1)
/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/analyze.go:36 +0x119
github.com/spf13/cobra.(*Command).execute(0xc651a0, 0xc4200aa010, 0x1, 0x1, 0xc651a0, 0xc4200aa010)
/home/wagoodman/go/src/github.com/spf13/cobra/command.go:766 +0x2c1
github.com/spf13/cobra.(*Command).ExecuteC(0xc651a0, 0x2, 0x7f2356cdf6c8, 0x0)
/home/wagoodman/go/src/github.com/spf13/cobra/command.go:852 +0x30a
github.com/spf13/cobra.(*Command).Execute(0xc651a0, 0xc4201e3f78, 0xc4201e3f58)
/home/wagoodman/go/src/github.com/spf13/cobra/command.go:800 +0x2b
github.com/wagoodman/dive/cmd.Execute()
/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/root.go:30 +0x2d
main.main()
/home/wagoodman/go/src/github.com/wagoodman/dive/main.go:38 +0xad


I have checked the output of this command on my machine, seems good for me:
$ /usr/bin/docker version --format {{.Server.APIVersion}}
1.39

Newly added content does not show dir content size

Permission    UID:GID       Size  Filetree
drwxr-xr-x        0:0      33 kB  └── usr
drwxrwxr-x       0:50      33 kB      └── local
drwxrwxr-x       0:50      33 kB          └── lib
drwxr-xr-x       0:50      33 kB              └── python3.6
drwxr-xr-x       0:50      33 kB                  └── site-packages
----------        0:0        0 B                      └── pip    <--- should be 33 kB
----------        0:0        0 B                          └── _vendor    <--- should be 33 kB
----------        0:0        0 B                              └── webencodings    <--- should be 33 kB
-rw-r--r--       0:50      11 kB                                  β”œβ”€β”€ __init__.py
drwxr-xr-x       0:50        0 B                                  β”œβ”€β”€ __pycache__
-rw-r--r--       0:50     9.2 kB                                  β”œβ”€β”€ labels.py
-rw-r--r--       0:50     1.4 kB                                  β”œβ”€β”€ mklabels.py
-rw-r--r--       0:50     6.7 kB                                  β”œβ”€β”€ tests.py
-rw-r--r--       0:50     4.6 kB                                  └── x_user_defined.py

Reproduce: on layer sha256:af42f63b41404741ab in image amir20/clashleaders:latest

RFE - Add an option to collapse all dirs

By default, all directories are uncollapsed.
Adding an option to collapse all directories would allow to easily spot layer's diff (combined with the ^L Show layer changes option) without having to manually collapse all directories.

Docker for windows in Linux subsystem - Could not connect to the Docker daemon

Also pure docker works, dive won't connect.

user@machine:/mnt/c/Users/user$ dive pgadmin4
Analyzing Image
Could not connect to the Docker daemon:unable to parse docker host `localhost:2375`
user@machine:/mnt/c/Users/user$ docker -H localhost:2375 images
REPOSITORY                                                          TAG                 IMAGE ID            CREATED             SIZE
docker4w/nsenter-dockerd                                            latest              2f1c802f322f        6 weeks ago         187kB
kdeneon/plasma                                                      user                c8b933e41707        6 weeks ago         2.59GB
kdeneon/plasma                                                      dev-unstable        1f69595e8fcb        6 weeks ago         2.59GB
openzipkin/zipkin                                                   latest              a4e6baafa76a        8 weeks ago         147MB
gcr.io/kubernetes-helm/tiller                                       v2.11.0             ac5f7ee9ae7e        2 months ago        71.8MB

Not working on Mac

Hi,

Just installed on Mac (mojave)

brew install dive                          
==> Installing dive from wagoodman/dive
==> Downloading https://github.com/wagoodman/dive/releases/download/v0.3.0/dive_0.3.0_darw
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/13325
######################################################################## 100.0%
🍺  /usr/local/Cellar/dive/0.3.0: 5 files, 10.7MB, built in 6 seconds

This is what happens when trying to attach to a container :

~/Dropbox/code> docker container ls | grep redis                                
876ded7dfe64        gcr.io/xxx-staging/redis-cluster/redis-cluster:5.0.1-v1   "/docker-entrypoint.…"   4 days ago          Up 4 days           6379/tcp, 0.0.0.0:7000-7005->7000-7005/tcp    redis-cluster
~/Dropbox/code> dive 876ded7dfe64
Analyzing Image
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: Service Unavailable
  Fetching metadata...
  Fetching image...panic: Error response from daemon: No such image: 876ded7dfe64

goroutine 1 [running]:
github.com/wagoodman/dive/image.check(...)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:29
github.com/wagoodman/dive/image.saveImage(0x7ffeefbff87d, 0xc, 0x0, 0x0, 0x0, 0x0)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:358 +0xccc
github.com/wagoodman/dive/image.InitializeData(0x7ffeefbff87d, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:217 +0x1cb
github.com/wagoodman/dive/cmd.analyze(0x19d8e40, 0xc00028fee0, 0x1, 0x1)
	/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/analyze.go:36 +0x1ab
github.com/spf13/cobra.(*Command).execute(0x19d8e40, 0xc0000a6010, 0x1, 0x1, 0x19d8e40, 0xc0000a6010)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:766 +0x2cc
github.com/spf13/cobra.(*Command).ExecuteC(0x19d8e40, 0x1, 0x1c00d80, 0x0)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:852 +0x2fd
github.com/spf13/cobra.(*Command).Execute(0x19d8e40, 0x19d8e40, 0xc0001ddf68)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:800 +0x2b
github.com/wagoodman/dive/cmd.Execute()
	/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/root.go:30 +0x2d
main.main()
	/home/wagoodman/go/src/github.com/wagoodman/dive/main.go:38 +0xa2

directory size is not calculated past the root level

It appears that the directory sizes are not calculated past the root.

screen shot 2018-10-29 at 8 29 53 am

Let's ignore the fact that I should have used --no-cache-dir, but I think that looks like an inconsistency.

To clarify, I am not sure if /root should show 77MB or 0. I am thinking that there should be an option to show the size that a directory contains, because all directories are "effectively" 0 (or very close to 0).

~tommy

Use dive with docker-machine on Mac?

The dive install instructions include the option for installing dive to a Mac using brew. However, it's not apparent if there's anyway to use dive with docker-machine on a Mac.

$ docker-machine ls
NAME      ACTIVE   DRIVER   STATE     URL                       SWARM   DOCKER        ERRORS
default   *        xhyve    Running   tcp://192.168.64.2:2376           v18.06.1-ce
$ dive busybox
Analyzing Image
Using default tag: latest
latest: Pulling from library/busybox
Digest: sha256:2a03a6059f21e150ae84b0973863609494aad70f0a80eaeb64bddd8d92465812
Status: Image is up to date for busybox:latest
  Fetching metadata...
  Fetching image...panic: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

It's clear why this error is happening: docker-machine doesn't open a socket in /var/run. Is there any workaround for this? Thanks.

Add file search

Add ability for user to search for a file in the tree. This should move the pane origin to that line and highlight it.

Support remote docker installations

The docker client can be set up to connect to a docker server remotely using the value specified in the DOCKER_HOST env variable, (e.g. DOCKER_HOST=tcp://127.0.0.1:2375)

This can be useful if you have a Windows machine running Docker and WSL connecting to it. Having this setup and trying to dive into a docker image, produces the error:

❯ dive jenkins/jenkins:latest
dive jenkins/jenkins:latest
Analyzing Image
latest: Pulling from jenkins/jenkins
Digest: sha256:5d9450a3b391e96a1525f6a5b40b3e2095df7a19195b6341fb097120cb0ab099
Status: Image is up to date for jenkins/jenkins:latest
  Fetching metadata...
  Fetching image...panic: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

goroutine 1 [running]:
github.com/wagoodman/dive/image.check(0x9d6de0, 0xc4202a9f60)
        /home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:27 +0x4a
github.com/wagoodman/dive/image.saveImage(0x7fffcd788c0c, 0x16, 0x0, 0x0, 0x0, 0x0)
        /home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:356 +0x3cd
github.com/wagoodman/dive/image.InitializeData(0x7fffcd788c0c, 0x16, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:215 +0x218
github.com/wagoodman/dive/cmd.analyze(0xc47fe0, 0xc4202a9bb0, 0x1, 0x1)
        /home/wagoodman/go/src/github.com/wagoodman/dive/cmd/analyze.go:21 +0xfc
github.com/spf13/cobra.(*Command).execute(0xc47fe0, 0xc42000c070, 0x1, 0x1, 0xc47fe0, 0xc42000c070)
        /home/wagoodman/go/src/github.com/spf13/cobra/command.go:766 +0x2c1
github.com/spf13/cobra.(*Command).ExecuteC(0xc47fe0, 0x1, 0x1, 0x0)
        /home/wagoodman/go/src/github.com/spf13/cobra/command.go:852 +0x30a
github.com/spf13/cobra.(*Command).Execute(0xc47fe0, 0xc420088058, 0x0)
        /home/wagoodman/go/src/github.com/spf13/cobra/command.go:800 +0x2b
github.com/wagoodman/dive/cmd.Execute()
        /home/wagoodman/go/src/github.com/wagoodman/dive/cmd/root.go:28 +0x2d
main.main()
        /home/wagoodman/go/src/github.com/wagoodman/dive/main.go:34 +0x20

Would it be feasible to use the value specified in DOCKER_HOST (if present) to connect to the docker server?

edit: replaced DOCKER_HOME with DOCKER_HOST to avoid any comprehension errors..

Intermittent crash indicates concurrent map writes

Images with more layers sometimes show this:

    β”œβ”€ 5e7ef813d8d0e74 : [========================================>] 100 % (6/6)fatal error: concurrent map writes
    β”œβ”€ 51b6e1d4f41395e : [========================================>] 100 % (2/2)
goroutine 54 [running]:: loading...
runtime.throw(0x97e2db, 0x15)=====================================>] 100 % (133/133)
    β”œβ”€ 2/usr/lib/golang/src/runtime/panic.go:616 +0x81 fp=0xc420397c28 sp=0xc420397c08 pc=0x42b131
runtime.mapassign_faststr(0x8da9e0, 0xc42037c750, 0xc4276ee230, 0x4a, 0x54)(20/20)
    β”œβ”€ 2/usr/lib/golang/src/runtime/hashmap_fast.go:703 +0x3e9 fp=0xc420397c98 sp=0xc420397c28 pc=0x40d2e9
github.com/wagoodman/dive/image.processLayerTar(0xc4284e72c0, 0xc42037c750, 0xc4276ee230, 0x4a, 0xc428958000, 0x1600, 0x1600)
    β”œβ”€ 1/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:192 +0x559 fp=0xc420397fa8 sp=0xc420397c98 pc=0x78f509
runtime.goexit()b00266 : loading...
    β”œβ”€ 0/usr/lib/golang/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc420397fb0 sp=0xc420397fa8 pc=0x457331
created by github.com/wagoodman/dive/image.InitializeData
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:280 +0x953

goroutine 1 [syscall]:
syscall.Syscall(0x0, 0x7, 0xc428a7e000, 0x40ee400, 0xc420000180, 0xc424d62040, 0x20)
	/usr/lib/golang/src/syscall/asm_linux_amd64.s:18 +0x5
syscall.read(0x7, 0xc428a7e000, 0x40ee400, 0x40ee400, 0xc424d62001, 0x0, 0x0)
	/usr/lib/golang/src/syscall/zsyscall_linux_amd64.go:749 +0x5f
syscall.Read(0x7, 0xc428a7e000, 0x40ee400, 0x40ee400, 0x0, 0x0, 0x43cbac)
	/usr/lib/golang/src/syscall/syscall_unix.go:162 +0x49
internal/poll.(*FD).Read(0xc4203ce190, 0xc428a7e000, 0x40ee400, 0x40ee400, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/internal/poll/fd_unix.go:153 +0x118
os.(*File).read(0xc42000e088, 0xc428a7e000, 0x40ee400, 0x40ee400, 0x0, 0xc4276b3700, 0x419a14)
	/usr/lib/golang/src/os/file_unix.go:226 +0x4e
os.(*File).Read(0xc42000e088, 0xc428a7e000, 0x40ee400, 0x40ee400, 0x10100c4276b3750, 0x0, 0x40ee400)
	/usr/lib/golang/src/os/file.go:107 +0x6a
archive/tar.(*regFileReader).Read(0xc4289143e0, 0xc428a7e000, 0x40ee400, 0x40ee400, 0xc4276b3758, 0xc4276b37d0, 0x440ef7)
	/usr/lib/golang/src/archive/tar/reader.go:662 +0x177
archive/tar.(*Reader).Read(0xc420434000, 0xc428a7e000, 0x40ee400, 0x40ee400, 0x40ee400, 0x40ee400, 0x0)
	/usr/lib/golang/src/archive/tar/reader.go:623 +0x7c
github.com/wagoodman/dive/image.InitializeData(0x7fffc22eb880, 0x1a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:275 +0x88a
github.com/wagoodman/dive/cmd.analyze(0xc49000, 0xc4202ddbd0, 0x1, 0x1)
	/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/analyze.go:35 +0xf9
github.com/spf13/cobra.(*Command).execute(0xc49000, 0xc4200c4010, 0x1, 0x1, 0xc49000, 0xc4200c4010)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:766 +0x2c1
github.com/spf13/cobra.(*Command).ExecuteC(0xc49000, 0x2, 0x7fcf3137b6c8, 0x0)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:852 +0x30a
github.com/spf13/cobra.(*Command).Execute(0xc49000, 0xc4201fbf78, 0xc4201fbf58)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:800 +0x2b
github.com/wagoodman/dive/cmd.Execute()
	/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/root.go:29 +0x2d
main.main()
	/home/wagoodman/go/src/github.com/wagoodman/dive/main.go:38 +0xad

goroutine 19 [syscall]:
os/signal.signal_recv(0x0)
	/usr/lib/golang/src/runtime/sigqueue.go:139 +0xa6
os/signal.loop()
	/usr/lib/golang/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.0
	/usr/lib/golang/src/os/signal/signal_unix.go:28 +0x41

goroutine 20 [chan receive]:
github.com/wagoodman/jotframe.pollSignals()
	/home/wagoodman/go/src/github.com/wagoodman/jotframe/signal.go:38 +0x81
created by github.com/wagoodman/jotframe.init.0
	/home/wagoodman/go/src/github.com/wagoodman/jotframe/root.go:17 +0x51

goroutine 4 [select, locked to thread]:
runtime.gopark(0x9982e0, 0x0, 0x9751f5, 0x6, 0x18, 0x1)
	/usr/lib/golang/src/runtime/proc.go:291 +0x11a
runtime.selectgo(0xc42005d750, 0xc420036180)
	/usr/lib/golang/src/runtime/select.go:392 +0xe50
runtime.ensureSigM.func1()
	/usr/lib/golang/src/runtime/signal_unix.go:549 +0x1f4
runtime.goexit()
	/usr/lib/golang/src/runtime/asm_amd64.s:2361 +0x1

goroutine 23 [IO wait]:
internal/poll.runtime_pollWait(0x7fcf3132ff00, 0x72, 0xc4203989a8)
	/usr/lib/golang/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc420386018, 0x72, 0xffffffffffffff00, 0x9d88e0, 0xc0f5b8)
	/usr/lib/golang/src/internal/poll/fd_poll_runtime.go:85 +0x9b
internal/poll.(*pollDesc).waitRead(0xc420386018, 0xc420335000, 0x1000, 0x1000)
	/usr/lib/golang/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc420386000, 0xc420335000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/internal/poll/fd_unix.go:157 +0x17d
net.(*netFD).Read(0xc420386000, 0xc420335000, 0x1000, 0x1000, 0x453220, 0xc420000180, 0x4)
	/usr/lib/golang/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc4200be460, 0xc420335000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/net/net.go:176 +0x6a
net/http.(*persistConn).Read(0xc4200d9320, 0xc420335000, 0x1000, 0x1000, 0xc420398b98, 0x4051c5, 0xc42039c000)
	/usr/lib/golang/src/net/http/transport.go:1453 +0x136
bufio.(*Reader).fill(0xc4202a4f00)
	/usr/lib/golang/src/bufio/bufio.go:100 +0x11e
bufio.(*Reader).Peek(0xc4202a4f00, 0x1, 0x0, 0x0, 0x0, 0xc4200a6600, 0x0)
	/usr/lib/golang/src/bufio/bufio.go:132 +0x3a
net/http.(*persistConn).readLoop(0xc4200d9320)
	/usr/lib/golang/src/net/http/transport.go:1601 +0x185
created by net/http.(*Transport).dialConn
	/usr/lib/golang/src/net/http/transport.go:1237 +0x95a

goroutine 24 [select]:
net/http.(*persistConn).writeLoop(0xc4200d9320)
	/usr/lib/golang/src/net/http/transport.go:1822 +0x14b
created by net/http.(*Transport).dialConn
	/usr/lib/golang/src/net/http/transport.go:1238 +0x97f

goroutine 7 [IO wait]:
internal/poll.runtime_pollWait(0x7fcf3132fe30, 0x72, 0xc4200709a8)
	/usr/lib/golang/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc4203c8318, 0x72, 0xffffffffffffff00, 0x9d88e0, 0xc0f5b8)
	/usr/lib/golang/src/internal/poll/fd_poll_runtime.go:85 +0x9b
internal/poll.(*pollDesc).waitRead(0xc4203c8318, 0xc4203da000, 0x1000, 0x1000)
	/usr/lib/golang/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc4203c8300, 0xc4203da000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/internal/poll/fd_unix.go:157 +0x17d
net.(*netFD).Read(0xc4203c8300, 0xc4203da000, 0x1000, 0x1000, 0x453220, 0xc420000180, 0x4)
	/usr/lib/golang/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc42000e070, 0xc4203da000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/net/net.go:176 +0x6a
net/http.(*persistConn).Read(0xc4203c05a0, 0xc4203da000, 0x1000, 0x1000, 0xc420070b98, 0x4051c5, 0xc4200365a0)
	/usr/lib/golang/src/net/http/transport.go:1453 +0x136
bufio.(*Reader).fill(0xc42008e6c0)
	/usr/lib/golang/src/bufio/bufio.go:100 +0x11e
bufio.(*Reader).Peek(0xc42008e6c0, 0x1, 0x0, 0x0, 0x0, 0xc42039c120, 0x0)
	/usr/lib/golang/src/bufio/bufio.go:132 +0x3a
net/http.(*persistConn).readLoop(0xc4203c05a0)
	/usr/lib/golang/src/net/http/transport.go:1601 +0x185
created by net/http.(*Transport).dialConn
	/usr/lib/golang/src/net/http/transport.go:1237 +0x95a

goroutine 8 [select]:
net/http.(*persistConn).writeLoop(0xc4203c05a0)
	/usr/lib/golang/src/net/http/transport.go:1822 +0x14b
created by net/http.(*Transport).dialConn
	/usr/lib/golang/src/net/http/transport.go:1238 +0x97f

goroutine 50 [runnable]:
archive/tar.(*Reader).handleRegularFile(...)
	/usr/lib/golang/src/archive/tar/reader.go:173
archive/tar.(*Reader).next(0xc420106000, 0x0, 0x0, 0x0)
	/usr/lib/golang/src/archive/tar/reader.go:82 +0x839
archive/tar.(*Reader).Next(0xc420106000, 0xc42899e2a0, 0xc428658990, 0xc)
	/usr/lib/golang/src/archive/tar/reader.go:52 +0x4e
github.com/wagoodman/dive/image.getFileList(0xc42047e000, 0x37c0400, 0x37c0400, 0x0, 0x0, 0x0)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:414 +0x193
github.com/wagoodman/dive/image.processLayerTar(0xc4203ce370, 0xc42037c750, 0xc42042cb90, 0x4a, 0xc42047e000, 0x37c0400, 0x37c0400)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:177 +0x98
created by github.com/wagoodman/dive/image.InitializeData
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:280 +0x953

goroutine 52 [runnable]:
archive/tar.(*Reader).Read(0xc424d6c240, 0xc42cbb4000, 0x1435a5, 0x1435a5, 0x1435a5, 0x1435a5, 0x30)
	/usr/lib/golang/src/archive/tar/reader.go:624 +0x119
github.com/wagoodman/dive/filetree.NewFileInfo(0xc424d6c240, 0xc427820d20, 0xc420036600, 0x57, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/wagoodman/go/src/github.com/wagoodman/dive/filetree/data.go:86 +0xc0
github.com/wagoodman/dive/image.getFileList(0xc424d94000, 0x2855600, 0x2855600, 0x0, 0x0, 0x0)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:433 +0x328
github.com/wagoodman/dive/image.processLayerTar(0xc420414320, 0xc42037c750, 0xc4201086e0, 0x4a, 0xc424d94000, 0x2855600, 0x2855600)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:177 +0x98
created by github.com/wagoodman/dive/image.InitializeData
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:280 +0x953

goroutine 98 [runnable]:
github.com/wagoodman/dive/image.processLayerTar(0xc428960050, 0xc42037c750, 0xc42042c0f0, 0x4a, 0xc428998000, 0xc00, 0xc00)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:192 +0x559
created by github.com/wagoodman/dive/image.InitializeData
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:280 +0x953
make: *** [Makefile:8: run] Error 2

This is within _, err = tarReader.Read(tarredBytes)

Error `open /home/wagoodman/Downloads/image/image.tar: no such file or directory`

I find this tool very cool, but I'm getting this error if I try to dive into a docker image:

❯ dive jenkins/jenkins
Analyzing Image
Using default tag: latest
latest: Pulling from jenkins/jenkins
Digest: sha256:5d9450a3b391e96a1525f6a5b40b3e2095df7a19195b6341fb097120cb0ab099
Status: Image is up to date for jenkins/jenkins:latest
open /home/wagoodman/Downloads/image/image.tar: no such file or directory

I installed the deb package 0.0.4 the way you stated in the Readme.

Unable to view layers below the fold in the layer list

I just noticed that I'm unable to view the bottom layers of an image with more layers than can fit in the layer list without scrolling. This is on a Centos7 machine.

Workaround seems to be to up the screen resolution so more layers fit in the window =)
That is how I got around it temporarily.

No output after analyze is complete

I am trying to analyze my image so I do dive amir20/clashleaders:latest but the output is just

Analyzing Image
  Fetching metadata...
  Fetching image... [========================================>] 100 % (732383094/732383094)
  Discovering layers... Done!
    β”œβ”€ fe1e5afb43ed34a : [========================================>] 100 % (88/88)
    β”œβ”€ fcd8df8c9190d61 : [========================================>] 100 % (2/2)
    β”œβ”€ f8ef4af78d7522b : [========================================>] 100 % (2/2)
    β”œβ”€ f5881ce6d4230f1 : [========================================>] 100 % (1/1)
    β”œβ”€ f4756fe92fa2ddd : [========================================>] 100 % (3/3)
    β”œβ”€ f1fff2d17be2595 : [========================================>] 100 % (3/3)
    β”œβ”€ e37dd9cdeab5bc9 : [========================================>] 100 % (1161/1161)
    β”œβ”€ b012947cf916f3f : [========================================>] 100 % (133/133)
    β”œβ”€ 9aacd2766e6a2ec : [========================================>] 100 % (6/6)
    β”œβ”€ 978c5dd8c85aed7 : [========================================>] 100 % (20/20)
    β”œβ”€ 872a3698cd48252 : [========================================>] 100 % (20295/20295)
    β”œβ”€ 83bc496b3e6ec08 : [========================================>] 100 % (4560/4560)
    β”œβ”€ 784a407086af827 : [========================================>] 100 % (7/7)
    β”œβ”€ 4739a29b9c1efee : [========================================>] 100 % (3065/3065)
    β”œβ”€ 3f7afb681dd579f : [========================================>] 100 % (2/2)
    β”œβ”€ 33159dfbc0aa015 : [========================================>] 100 % (2/2)
    β”œβ”€ 249d0a05e235908 : [========================================>] 100 % (4/4)
    β”œβ”€ 183130a02e2da7c : [========================================>] 100 % (844/844)
    β”œβ”€ 130e36bb4024ea3 : [========================================>] 100 % (1063/1063)
    β”œβ”€ 00161debf16fe45 : [========================================>] 100 % (621/621)
  Fetching image config...
  Building tree...
  Analyzing layers...

Here is a video to show what is happeneing https://asciinema.org/a/NLYNgFDU7o3jdVBX1q247sHP8

Compute "image efficiency" and display in a stats window.

"Efficiency" is basically the property of not having the same information in several different layers.

This metric should indicate what amount of layer overlap there is (in terms of # or files and in total inflated image size). This would give the user an indication that there is room for Dockerfile improvements.

Suggestion - change space to "page down"

Thanks to @akshaychhajed for writing the left/right "arrow stuff" !

Another recommendation, is that in the "xxx Layer Contents" view, "space" should be used as a "page down" key, similar to using "less" or "more" to page through the contents of a file. I am not sure what other file browsing interface makes me think to use space to scroll down, so I will stick with less/more. I suppose you could enable "page up" and "page down" while you are at it, but space feels more natural for some reason, at least to me. :)

This may require a slight adjustment to the "left arrow" UI that was merged over the weekend, such that if you hit left arrow on an expanded directory, it will compress it, if it is already compressed, you will move up to the parent directory. If this is too complex (overloading the left arrow too much), maybe we could select a different modifier?

~tommy

Check for known types of leftover files in efficiency test (eg logs, APT cache)

The efficiency test currently checks whether files were removed in the wrong layer or duplicated, however it would be great if it also identified files that could be removed from the final image entirely.

For example:

  • A subset of the files under /var/cache/apt/
  • /var/lib/apt/lists/*
  • /var/log/*
  • ...and possibly others like man pages and docs

The file/directory lists here (which are used for generating the "slim" docker image variants) might be a good starting point:
https://github.com/debuerreotype/debuerreotype/blob/master/scripts/.slimify-excludes

Whole tree expands when layer selection is changed

To repro

  1. View a tree, go to the main view.
  2. CTRL + space over to the left side view
  3. Move press down arrow

Expected behavior:

Collapsed nodes that exist in both views should stay collapsed

Actual behavior:

Entire tree re-expands.

efficiency score seems incorrect for scratch image

is this important

no

reproduce

echo "**" > .dockerignore
echo "FROM scratch" > Dockerfile
echo "WORKDIR /srv" >> Dockerfile

docker build --tag test .
dive test
[Layer Details]───────────────────────────────────────────────────────────────────────────────────────

Digest: sha256:6bbced1c7a488db9217269f23992c59274868d0c20b8efc7358e808abbffa78d
Tar ID: a5296223b7706b8b74f0c07dce78c67bc8378769234ab2ddf79ddfc747eb7eab
Command:
/bin/sh -c #(nop) WORKDIR /srv

[Image Details]───────────────────────────────────────────────────────────────────────────────────────

Total Image size: 0 B
Potential wasted space: 0 B
Image efficiency score: -9223372036854775808 %

Count   Total Space  Path

Crash when Docker isn't started

When trying to run dive without Docker running, it crashes:

panic: exit status 1

goroutine 1 [running]:
github.com/wagoodman/dive/utils.DiscoverDockerVersion(0x1545440, 0x0)
	/home/wagoodman/go/src/github.com/wagoodman/dive/utils/docker.go:42 +0x18d
github.com/wagoodman/dive/image.InitializeData(0x7ffeefbffcb5, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/wagoodman/go/src/github.com/wagoodman/dive/image/image.go:202 +0xf2
github.com/wagoodman/dive/cmd.analyze(0x1857c80, 0xc420291c90, 0x1, 0x1)
	/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/analyze.go:36 +0x119
github.com/spf13/cobra.(*Command).execute(0x1857c80, 0xc4200a8010, 0x1, 0x1, 0x1857c80, 0xc4200a8010)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:766 +0x2c1
github.com/spf13/cobra.(*Command).ExecuteC(0x1857c80, 0x2, 0x19416c8, 0x0)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:852 +0x30a
github.com/spf13/cobra.(*Command).Execute(0x1857c80, 0xc4201cdf78, 0xc4201cdf58)
	/home/wagoodman/go/src/github.com/spf13/cobra/command.go:800 +0x2b
github.com/wagoodman/dive/cmd.Execute()
	/home/wagoodman/go/src/github.com/wagoodman/dive/cmd/root.go:30 +0x2d
main.main()
	/home/wagoodman/go/src/github.com/wagoodman/dive/main.go:38 +0xad

Console cursor is not restored on errors

When calling dive by itself, or with invalid arguments the console cursor is not restored.

It is restored in golden cases by use of:

dive/cmd/root.go

Lines 39 to 41 in 5dfd9fb

func init() {
ansi.CursorHide()
atexit.Register(exitHandler)

and

dive/cmd/root.go

Lines 35 to 37 in 5dfd9fb

func exitHandler() {
ansi.CursorShow()
}

However if os.Exit(1) is called (which is a lot) on-exit handlers are not called.

I would suggest refactoring out all os.Exit(1) calls to return err, and have a single spot to call ansi.CursorShow().

Make CI friendly

A fun use case would be to use this tool as a static analysis tool in a CI pipeline. When running dive against a built image, dive would pass/fail (return 0 or non-0) with configurable thresholds for efficiency score and/or waisted image space.

This implies disabling the UI and only output minimal information.

Enhance pre-processing indications with progress

Currently there is a simple indication for fetching image, reading image, parsing image config, and building tree. For large images some of these steps could take a while. It would be awesome if there was a way to indicate progress for these tasks and break it down by parallel sub-tasks when possible.

Though jotframe is still in development, it would be a good candidate for some of these tasks.

Wrap docker build with dive

It would be great to not have to do docker build -t blah . ; dive blah but to instead run dive build -t blah . which would invoke docker to build the image followed by an immediate analysis.

reduce memory consumption

After reading the tar contents we should ensure that temp buffers don't keep these contents indefinitely.

πŸ™ give a way to squash layers

Hi,

As you seem to be mastering the docker layers, could you please give a way to squash multiple layers together.

Sometimes, docker images contains a layer with dozen of files removed on another layers.

Thanks in advance

`--version` argument

Can you add a --version argument? I have a script I use to ensure the latest version of certain tools are installed and it won't work without some type of version information being output. Great tool BTW. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.