0
点赞
收藏
分享

微信扫一扫

Docker镜像解析工具--dive

茗越 2022-03-10 阅读 72

   简介:

     Dive是Git上的一个开源项目,该工具用于探索 Docker 镜像层的内容和发现压缩 Docker/OCI 镜像大小方法的工具。

代码地址: 

GitHub - wagoodman/dive: A tool for exploring each layer in a docker imageA tool for exploring each layer in a docker image. Contribute to wagoodman/dive development by creating an account on GitHub.https://github.com/wagoodman/dive

安装方法: 

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 BindingDescription
Ctrl + CExit
TabSwitch between the layer and filetree views
Ctrl + FFilter files
PageUpScroll up a page
PageDownScroll down a page
Ctrl + ALayer view: see aggregated image modifications
Ctrl + LLayer view: see current layer modifications
SpaceFiletree view: collapse/uncollapse a directory
Ctrl + SpaceFiletree view: collapse/uncollapse all directories
Ctrl + AFiletree view: show/hide added files
Ctrl + RFiletree view: show/hide removed files
Ctrl + MFiletree view: show/hide modified files
Ctrl + UFiletree view: show/hide unmodified files
Ctrl + BFiletree view: show/hide file attributes
PageUpFiletree view: scroll up a page
PageDownFiletree view: scroll down a page
举报

相关推荐

0 条评论