简介:
Dive是Git上的一个开源项目,该工具用于探索 Docker 镜像层的内容和发现压缩 Docker/OCI 镜像大小方法的工具。
代码地址:
安装方法:
Ubuntu/Debian
wget https://github.com/wagoodman/dive/releases/download/v0.9.2/dive_0.9.2_linux_amd64.deb
sudo apt install ./dive_0.9.2_linux_amd64.deb
RHEL/Centos
curl -OL https://github.com/wagoodman/dive/releases/download/v0.9.2/dive_0.9.2_linux_amd64.rpm
rpm -i dive_0.9.2_linux_amd64.rpm
Arch Linux
yay -S dive
Mac
使用Homebrew软件源
brew install dive
使用MacPorts软件源
sudo port install dive
Windows
下载 latest release.
Go tools Requires Go version 1.10 or higher.
go get github.com/wagoodman/dive
Docker
docker pull wagoodman/dive
or
docker pull quay.io/wagoodman/dive
使用方法:
分析镜像:
dive <your-image-tag>
构建镜像并分析:
dive build -t <some-tag> .
Docker方式构建分析镜像:
docker run --rm -it \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$(pwd)":"$(pwd)" \
-w "$(pwd)" \
-v "$HOME/.dive.yaml":"$HOME/.dive.yaml" \
wagoodman/dive:latest build -t <some-tag> .
快捷键:
Key Binding | Description |
---|---|
Ctrl + C | Exit |
Tab | Switch between the layer and filetree views |
Ctrl + F | Filter files |
PageUp | Scroll up a page |
PageDown | Scroll down a page |
Ctrl + A | Layer view: see aggregated image modifications |
Ctrl + L | Layer view: see current layer modifications |
Space | Filetree view: collapse/uncollapse a directory |
Ctrl + Space | Filetree view: collapse/uncollapse all directories |
Ctrl + A | Filetree view: show/hide added files |
Ctrl + R | Filetree view: show/hide removed files |
Ctrl + M | Filetree view: show/hide modified files |
Ctrl + U | Filetree view: show/hide unmodified files |
Ctrl + B | Filetree view: show/hide file attributes |
PageUp | Filetree view: scroll up a page |
PageDown | Filetree view: scroll down a page |