├── .mds-list ├── .gitignore ├── sync-en.sh ├── en.md └── readme.md /.mds-list: -------------------------------------------------------------------------------- 1 | ./source/README.md 2 | 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .DS_Store 3 | fork 4 | source 5 | hub-create.sh -------------------------------------------------------------------------------- /sync-en.sh: -------------------------------------------------------------------------------- 1 | cat './.mds-list' | while read line 2 | do 3 | testseq="zh.md" 4 | if [[ $line =~ $testseq || "$line" == "" ]]; then 5 | echo "skip $line" 6 | else 7 | lowline=`echo "$line" | awk '{print tolower($0)}'` 8 | # lowwer string 9 | zh=${line//source\//} 10 | dir=$(dirname $zh) 11 | 12 | source_readme="./source/readme.md" 13 | if [[ $lowline == $source_readme ]];then 14 | # source/[readme|REAMDE].md => en.md 15 | filename="en.md" 16 | else 17 | # source/other.md => ./other.md 18 | filename=$(basename $zh) 19 | fi 20 | echo "$line >> $dir/$filename" 21 | mkdir -p $dir && cp $line "$_/$filename" 22 | fi 23 | done -------------------------------------------------------------------------------- /en.md: -------------------------------------------------------------------------------- 1 | # dive 2 | [![Go Report Card](https://goreportcard.com/badge/github.com/wagoodman/dive)](https://goreportcard.com/report/github.com/wagoodman/dive) 3 | 4 | **A tool for exploring a docker image, layer contents, and discovering ways to shrink your Docker image size.** 5 | 6 | ![Image](.data/demo.gif) 7 | 8 | To analyze a Docker image simply run dive with an image tag/id/digest: 9 | ```bash 10 | dive 11 | ``` 12 | 13 | or if you want to build your image then jump straight into analyzing it: 14 | ```bash 15 | dive build -t . 16 | ``` 17 | 18 | **This is beta quality!** *Feel free to submit an issue if you want a new feature or find a bug :)* 19 | 20 | ## Basic Features 21 | 22 | **Show Docker image contents broken down by layer** 23 | 24 | As you select a layer on the left, you are shown the contents of that layer 25 | combined with all previous layers on the right. Also, you can fully explore the 26 | file tree with the arrow keys. 27 | 28 | **Indicate what's changed in each layer** 29 | 30 | Files that have changed, been modified, added, or removed are indicated in the 31 | file tree. This can be adjusted to show changes for a specific layer, or 32 | aggregated changes up to this layer. 33 | 34 | **Estimate "image efficiency"** 35 | 36 | The lower left pane shows basic layer info and an experimental metric that will 37 | guess how much wasted space your image contains. This might be from duplicating 38 | files across layers, moving files across layers, or not fully removing files. 39 | Both a percentage "score" and total wasted file space is provided. 40 | 41 | **Quick build/analysis cycles** 42 | 43 | You can build a Docker image and do an immediate analysis with one command: 44 | `dive build -t some-tag .` 45 | 46 | You only need to replace your `docker build` command with the same `dive build` 47 | command. 48 | 49 | 50 | ## Installation 51 | 52 | **Ubuntu/Debian** 53 | ```bash 54 | wget https://github.com/wagoodman/dive/releases/download/v0.3.0/dive_0.3.0_linux_amd64.deb 55 | sudo apt install ./dive_0.3.0_linux_amd64.deb 56 | ``` 57 | 58 | **RHEL/Centos** 59 | ```bash 60 | curl -OL https://github.com/wagoodman/dive/releases/download/v0.3.0/dive_0.3.0_linux_amd64.rpm 61 | rpm -i dive_0.3.0_linux_amd64.rpm 62 | ``` 63 | 64 | **Arch Linux** 65 | 66 | Available as [dive](https://aur.archlinux.org/packages/dive/) in the Arch User Repository (AUR). 67 | 68 | ```bash 69 | aurman -S dive 70 | ``` 71 | 72 | The above example assumes `aurman` as the tool for installing AUR packages. 73 | *Note*: the AUR repository is **not** controlled by the dive project maintainer. 74 | 75 | **Mac** 76 | ```bash 77 | brew tap wagoodman/dive 78 | brew install dive 79 | ``` 80 | or download a Darwin build from the releases page. 81 | 82 | **Go tools** 83 | ```bash 84 | go get github.com/wagoodman/dive 85 | ``` 86 | 87 | **Docker** 88 | ```bash 89 | docker pull wagoodman/dive 90 | ``` 91 | 92 | or 93 | 94 | ```bash 95 | docker pull quay.io/wagoodman/dive 96 | ``` 97 | 98 | When running you'll need to include the docker client binary and socket file: 99 | ```bash 100 | docker run --rm -it \ 101 | -v /var/run/docker.sock:/var/run/docker.sock \ 102 | wagoodman/dive:latest 103 | ``` 104 | 105 | Docker for Windows (showing PowerShell compatible line breaks; collapse to a single line for Command Prompt compatibility) 106 | ```bash 107 | docker run --rm -it ` 108 | -v /var/run/docker.sock:/var/run/docker.sock ` 109 | wagoodman/dive:latest 110 | ``` 111 | 112 | **Note:** depending on the version of docker you are running locally you may need to specify the docker API version as an environment variable: 113 | ```bash 114 | DOCKER_API_VERSION=1.37 dive ... 115 | ``` 116 | or if you are running with a docker image: 117 | ```bash 118 | docker run --rm -it \ 119 | -v /var/run/docker.sock:/var/run/docker.sock \ 120 | -e DOCKER_API_VERSION=1.37 121 | wagoodman/dive:latest 122 | ``` 123 | 124 | ## KeyBindings 125 | 126 | Key Binding | Description 127 | -------------------------------------------|--------------------------------------------------------- 128 | Ctrl + C | Exit 129 | Tab or Ctrl + Space | Switch between the layer and filetree views 130 | Ctrl + F | Filter files 131 | Ctrl + A | Layer view: see aggregated image modifications 132 | Ctrl + L | Layer view: see current layer modifications 133 | Space | Filetree view: collapse/uncollapse a directory 134 | Ctrl + A | Filetree view: show/hide added files 135 | Ctrl + R | Filetree view: show/hide removed files 136 | Ctrl + M | Filetree view: show/hide modified files 137 | Ctrl + U | Filetree view: show/hide unmodified files 138 | PageUp | Filetree view: scroll up a page 139 | PageDown | Filetree view: scroll down a page 140 | 141 | ## Configuration 142 | 143 | No configuration is necessary, however, you can create a config file and override values: 144 | ```yaml 145 | log: 146 | enabled: true 147 | path: ./dive.log 148 | level: info 149 | 150 | # Note: you can specify multiple bindings by separating values with a comma. 151 | # Note: UI hinting is derived from the first binding 152 | keybinding: 153 | # Global bindings 154 | quit: ctrl+c 155 | toggle-view: tab, ctrl+space 156 | filter-files: ctrl+f, ctrl+slash 157 | 158 | # Layer view specific bindings 159 | compare-all: ctrl+a 160 | compare-layer: ctrl+l 161 | 162 | # File view specific bindings 163 | toggle-collapse-dir: space 164 | toggle-added-files: ctrl+a 165 | toggle-removed-files: ctrl+r 166 | toggle-modified-files: ctrl+m 167 | toggle-unmodified-files: ctrl+u 168 | page-up: pgup 169 | page-down: pgdn 170 | 171 | diff: 172 | # You can change the default files show in the filetree (right pane). All diff types are shown by default. 173 | hide: 174 | - added 175 | - removed 176 | - changed 177 | - unchanged 178 | 179 | filetree: 180 | # The default directory-collapse state 181 | collapse-dir: false 182 | 183 | # The percentage of screen width the filetree should take on the screen (must be >0 and <1) 184 | pane-width: 0.5 185 | 186 | layer: 187 | # Enable showing all changes from this layer and ever previous layer 188 | show-aggregated-changes: false 189 | 190 | ``` 191 | 192 | dive will search for configs in the following locations: 193 | - `~/.dive.yaml` 194 | - `$XDG_CONFIG_HOME/dive.yaml` 195 | - `~/.config/dive.yaml` 196 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # wagoodman/dive [![explain]][source] [![translate-svg]][translate-list] 2 | 3 | 4 | 5 | [explain]: http://llever.com/explain.svg 6 | [source]: https://github.com/chinanf-boy/Source-Explain 7 | [translate-svg]: http://llever.com/translate.svg 8 | [translate-list]: https://github.com/chinanf-boy/chinese-translate-list 9 | [size-img]: https://packagephobia.now.sh/badge?p=Name 10 | [size]: https://packagephobia.now.sh/result?p=Name 11 | 12 | 「 **用于探索 docker 镜像,图层内容以及发现缩小 Docker 镜像大小的方法的工具.** 」 13 | 14 | [中文](./readme.md) | [english](https://github.com/wagoodman/dive) 15 | 16 | --- 17 | 18 | ## 校对 ✅ 19 | 20 | 21 | 22 | 23 | 24 | 翻译的原文 | 与日期 | 最新更新 | 更多 25 | ---|---|---|--- 26 | [commit] | ⏰ 2018-11-25 | ![last] | [中文翻译][translate-list] 27 | 28 | [last]: https://img.shields.io/github/last-commit/wagoodman/dive.svg 29 | [commit]: https://github.com/wagoodman/dive/tree/d9ec426300be6c96bab5f2299ff4a68bece79ba4 30 | 31 | 32 | 33 | ### 贡献 34 | 35 | 欢迎 👏 勘误/校对/更新贡献 😊 [具体贡献请看](https://github.com/chinanf-boy/chinese-translate-list#贡献) 36 | 37 | ## 生活 38 | 39 | [If help, **buy** me coffee —— 营养跟不上了,给我来瓶营养快线吧! 💰](https://github.com/chinanf-boy/live-need-money) 40 | 41 | --- 42 | 43 | 44 | # dive 45 | 46 | [![Go Report Card](https://goreportcard.com/badge/github.com/wagoodman/dive)](https://goreportcard.com/report/github.com/wagoodman/dive) 47 | 48 | **用于探索 docker 镜像,图层内容以及发现缩小 Docker 镜像大小的方法的工具.** 49 | 50 | ![Image](https://github.com/wagoodman/dive/blob/master/.data/demo.gif?raw=true) 51 | 52 | ### 目录 53 | 54 | 55 | 56 | 57 | 58 | - [简单入门](#%E7%AE%80%E5%8D%95%E5%85%A5%E9%97%A8) 59 | - [基本功能](#%E5%9F%BA%E6%9C%AC%E5%8A%9F%E8%83%BD) 60 | - [安装](#%E5%AE%89%E8%A3%85) 61 | - [键绑定](#%E9%94%AE%E7%BB%91%E5%AE%9A) 62 | - [配置](#%E9%85%8D%E7%BD%AE) 63 | 64 | 65 | 66 | ## 简单入门 67 | 68 | 要分析 Docker 镜像,只需带上镜像的 tag/id/digest, 运行 dive: 69 | 70 | ```bash 71 | dive 72 | ``` 73 | 74 | 或者如果你想建立你的镜像,那么可直接分析它: 75 | 76 | ```bash 77 | dive build -t . 78 | ``` 79 | 80 | **软件还处于 beta 阶段!** _如果您想要新功能或发现错误,请随时提交问题:)_ 81 | 82 | ## 基本功能 83 | 84 | **显示,按层细分的 Docker 镜像内容** 85 | 86 | 当您在左侧选择一个图层时,将显示该图层的内容,及在右侧,显示所有先前图层。此外,您可以使用箭头按键,(想去哪就去哪)浏览文件树。 87 | 88 | **指出每层中发生了哪些变化** 89 | 90 | 已更改,已修改,添加或删除的文件,在文件树中都有指示。可以调整此值以显示特定图层的更改,或直到集合此图层的更改。 91 | 92 | **估计"镜像效率"** 93 | 94 | 左下方窗格,显示基本图层信息和一个实验指标,用于猜测镜像所包含的空间浪费。其中可能包括: 跨层重复文件,跨层移动文件或不完全删除文件。提供了百分比"得分",和总浪费的文件空间。 95 | 96 | **快速构建/分析周期** 97 | 98 | 您可以构建 Docker 镜像,并立即使用一个 dive build -t some-tag .`命令进行分析:` 99 | 100 | 你仅仅只要将你的`docker build`命令更换成`dive build`命令。 101 | 102 | ## 安装 103 | 104 | **Ubuntu/Debian** 105 | 106 | ```bash 107 | wget https://github.com/wagoodman/dive/releases/download/v0.3.0/dive_0.3.0_linux_amd64.deb 108 | sudo apt install ./dive_0.3.0_linux_amd64.deb 109 | ``` 110 | 111 | **RHEL /Centos** 112 | 113 | ```bash 114 | curl -OL https://github.com/wagoodman/dive/releases/download/v0.3.0/dive_0.3.0_linux_amd64.rpm 115 | rpm -i dive_0.3.0_linux_amd64.rpm 116 | ``` 117 | 118 | **Arch Linux** 119 | 120 | 可用作[dive](https://aur.archlinux.org/packages/dive/)在 Arch User Repository(AUR)中. 121 | 122 | ```bash 123 | aurman -S dive 124 | ``` 125 | 126 | 上面的例子假设`aurman`作为安装 AUR 包的工具。_注意_:AUR 存储库是**不**由 dive 项目维护人员控制. 127 | 128 | **Mac** 129 | 130 | ```bash 131 | brew tap wagoodman/dive 132 | brew install dive 133 | ``` 134 | 135 | 或从发布(releases)页面下载 Darwin 版本. 136 | 137 | **Go 工具** 138 | 139 | ```bash 140 | go get github.com/wagoodman/dive 141 | ``` 142 | 143 | **Docker** 144 | 145 | ```bash 146 | docker pull wagoodman/dive 147 | ``` 148 | 149 | 要么 150 | 151 | ```bash 152 | docker pull quay.io/wagoodman/dive 153 | ``` 154 | 155 | 运行时,您需要包含 docker 客户端二进制文件和 socket 文件: 156 | 157 | ```bash 158 | docker run --rm -it \ 159 | -v /var/run/docker.sock:/var/run/docker.sock \ 160 | wagoodman/dive:latest 161 | ``` 162 | 163 | 适用于 Windows Docker(显示 PowerShell 兼容的换行符;折叠为一行以实现命令提示符兼容性) 164 | 165 | ```bash 166 | docker run --rm -it ` 167 | -v /var/run/docker.sock:/var/run/docker.sock ` 168 | wagoodman/dive:latest 169 | ``` 170 | 171 | **注意:**根据您在本地运行的 docker 版本,您可能需要将 docker API 版本指定为环境变量: 172 | 173 | ```bash 174 | DOCKER_API_VERSION=1.37 dive ... 175 | ``` 176 | 177 | 或者如果您在一个 docker 镜像运行: 178 | 179 | ```bash 180 | docker run --rm -it \ 181 | -v /var/run/docker.sock:/var/run/docker.sock \ 182 | -e DOCKER_API_VERSION=1.37 183 | wagoodman/dive:latest 184 | ``` 185 | 186 | ## 键绑定 187 | 188 | | 键绑定 | 描述 | 189 | | ----------------------------------------- | --------------------------------- | 190 | | Ctrl + C | Exit | 191 | | Tab or Ctrl + Space | 在图层和文件树视图之间切换 | 192 | | Ctrl + F | 过滤文件 | 193 | | Ctrl + A | 图层视图:查看聚合镜像修改 | 194 | | Ctrl + L | 图层视图:查看当前图层修改 | 195 | | Space | 文件树 视图:折叠/取消折叠目录 | 196 | | Ctrl + A | 文件树 视图:显示/隐藏添加的文件 | 197 | | Ctrl + R | 文件树 视图:显示/隐藏已删除的文件 | 198 | | Ctrl + M | 文件树 视图:显示/隐藏已修改的文件 | 199 | | Ctrl + U | 文件树 视图:显示/隐藏未修改的文件 | 200 | | PageUp | 文件树 视图:向上滚动页面 | 201 | | PageDown | 文件树 视图:向下滚动页面 | 202 | 203 | ## 配置 204 | 205 | 无需配置,但是,您可以创建配置文件,并覆盖默认值: 206 | 207 | ```yaml 208 | log: 209 | enabled: true 210 | path: ./dive.log 211 | level: info 212 | 213 | # 注意:您可以通过用逗号分隔值来指定多个绑定。 214 | # 注意:UI提示,只为第一个绑定 215 | keybinding: 216 | # 全局绑定 217 | quit: ctrl+c 218 | toggle-view: tab, ctrl+space 219 | filter-files: ctrl+f, ctrl+slash 220 | 221 | # 层视图特定绑定 222 | compare-all: ctrl+a 223 | compare-layer: ctrl+l 224 | 225 | # 文件视图特定绑定 226 | toggle-collapse-dir: space 227 | toggle-added-files: ctrl+a 228 | toggle-removed-files: ctrl+r 229 | toggle-modified-files: ctrl+m 230 | toggle-unmodified-files: ctrl+u 231 | page-up: pgup 232 | page-down: pgdn 233 | 234 | diff: 235 | # 您可以更改 filetree 中显示的默认文件(右窗格)。 默认情况下显示所有diff类型。 236 | hide: 237 | - added 238 | - removed 239 | - changed 240 | - unchanged 241 | 242 | filetree: 243 | # 默认目录折叠状态 244 | collapse-dir: false 245 | 246 | # 文件树应在屏幕上显示的屏幕宽度百分比(必须 >0 且 <1 ) 247 | pane-width: 0.5 248 | 249 | layer: 250 | # 启用显示此图层和之前图层的所有更改 251 | show-aggregated-changes: false 252 | ``` 253 | 254 | dive 将在以下位置搜索配置: 255 | 256 | - `~/.dive.yaml` 257 | - `$XDG_CONFIG_HOME/dive.yaml` 258 | - `~/.config/dive.yaml` 259 | --------------------------------------------------------------------------------