{"id":13396194,"url":"https://github.com/wagoodman/dive","last_synced_at":"2025-05-12T17:43:34.075Z","repository":{"id":37413001,"uuid":"133251103","full_name":"wagoodman/dive","owner":"wagoodman","description":"A tool for exploring each layer in a docker image","archived":false,"fork":false,"pushed_at":"2025-04-24T01:36:14.000Z","size":6930,"stargazers_count":50567,"open_issues_count":159,"forks_count":1873,"subscribers_count":359,"default_branch":"main","last_synced_at":"2025-05-05T15:09:43.277Z","etag":null,"topics":["cli","docker","docker-image","explorer","inspector","tui"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wagoodman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["wagoodman"]}},"created_at":"2018-05-13T15:44:01.000Z","updated_at":"2025-05-05T13:06:58.000Z","dependencies_parsed_at":"2022-08-08T20:15:38.668Z","dependency_job_id":"b23d17e9-33a5-4519-a183-6d07b1ceb847","html_url":"https://github.com/wagoodman/dive","commit_stats":{"total_commits":385,"total_committers":56,"mean_commits":6.875,"dds":0.4441558441558442,"last_synced_commit":"3ef1dd2c74c6952064d866adc2b225048d939f83"},"previous_names":["wagoodman/docker-image-explorer"],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wagoodman%2Fdive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wagoodman%2Fdive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wagoodman%2Fdive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wagoodman%2Fdive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wagoodman","download_url":"https://codeload.github.com/wagoodman/dive/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253789597,"owners_count":21964702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","docker","docker-image","explorer","inspector","tui"],"created_at":"2024-07-30T18:00:42.211Z","updated_at":"2025-05-12T17:43:32.781Z","avatar_url":"https://github.com/wagoodman.png","language":"Go","funding_links":["https://github.com/sponsors/wagoodman","https://www.paypal.me/wagoodman"],"categories":["Container Operations","Go","Misc","Docker","docker","开源工具","HarmonyOS","CLI tools","cli","Development Environment","Cloud / Docker / Kubernetes","Command Line Tools","Practices","CLI Tools","Utilities","语言资源库","Containers","公用事业公司","其他__大数据","Tools","User Interfaces","容器工具","常用工具","Management Tools","Docker-Tools","Virtualization","\u003ca name=\"vm\"\u003e\u003c/a\u003eContainerization and virtualization","Container Tools","Image","0x02 工具 :hammer_and_wrench:","Filesystem","Back End Development","Table of Contents","容器管理与运维 (Container Operations)","工具：覆盖攻防全流程的实用利器","\u003ca name=\"Go\"\u003e\u003c/a\u003eGo","Docker \u0026 Kubernetes","Container Security","📦 Containers"],"sub_categories":["User Interface","Snippets Manager","Docker工具","Windows Manager","Version Control","Docker and Containerization","Utility/Miscellaneous","go","Threat modelling","实用程序/Miscellaneous","网络服务_其他","Others","Terminal","Go","爬虫工具","Books","2 云原生工具","Container Tools","终端工具 (Terminal / CLI Tools)","6. 辅助工具（优化 Docker 安全配置）","collection","Image Scanning","Observability"],"readme":"# dive\n[![GitHub release](https://img.shields.io/github/release/wagoodman/dive.svg)](https://github.com/wagoodman/dive/releases/latest)\n[![Validations](https://github.com/wagoodman/dive/actions/workflows/validations.yaml/badge.svg)](https://github.com/wagoodman/dive/actions/workflows/validations.yaml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/wagoodman/dive)](https://goreportcard.com/report/github.com/wagoodman/dive)\n[![License: MIT](https://img.shields.io/badge/License-MIT%202.0-blue.svg)](https://github.com/wagoodman/dive/blob/main/LICENSE)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg?style=flat)](https://www.paypal.me/wagoodman)\n\n**A tool for exploring a Docker image, layer contents, and discovering ways to shrink the size of your Docker/OCI image.**\n\n\n![Image](.data/demo.gif)\n\nTo analyze a Docker image simply run dive with an image tag/id/digest:\n```bash\ndive \u003cyour-image-tag\u003e\n```\n\nor you can dive with Docker directly:\n```\nalias dive=\"docker run -ti --rm  -v /var/run/docker.sock:/var/run/docker.sock docker.io/wagoodman/dive\"\ndive \u003cyour-image-tag\u003e\n\n# for example\ndive nginx:latest\n```\n\nor if you want to build your image then jump straight into analyzing it:\n```bash\ndive build -t \u003csome-tag\u003e .\n```\n\nBuilding on macOS (supporting only the Docker container engine):\n\n```bash\ndocker run --rm -it \\\n      -v /var/run/docker.sock:/var/run/docker.sock \\\n      -v  \"$(pwd)\":\"$(pwd)\" \\\n      -w \"$(pwd)\" \\\n      -v \"$HOME/.dive.yaml\":\"$HOME/.dive.yaml\" \\\n      docker.io/wagoodman/dive:latest build -t \u003csome-tag\u003e .\n```\n\nAdditionally you can run this in your CI pipeline to ensure you're keeping wasted space to a minimum (this skips the UI):\n```\nCI=true dive \u003cyour-image\u003e\n```\n\n![Image](.data/demo-ci.png)\n\n**This is beta quality!** *Feel free to submit an issue if you want a new feature or find a bug :)*\n\n## Basic Features\n\n**Show Docker image contents broken down by layer**\n\nAs you select a layer on the left, you are shown the contents of that layer combined with all previous layers on the right. Also, you can fully explore the file tree with the arrow keys.\n\n**Indicate what's changed in each layer**\n\nFiles that have changed, been modified, added, or removed are indicated in the file tree. This can be adjusted to show changes for a specific layer, or aggregated changes up to this layer.\n\n**Estimate \"image efficiency\"**\n\nThe lower left pane shows basic layer info and an experimental metric that will guess how much wasted space your image contains. This might be from duplicating files across layers, moving files across layers, or not fully removing files. Both a percentage \"score\" and total wasted file space is provided.\n\n**Quick build/analysis cycles**\n\nYou can build a Docker image and do an immediate analysis with one command:\n`dive build -t some-tag .`\n\nYou only need to replace your `docker build` command with the same `dive build`\ncommand.\n\n**CI Integration**\n\nAnalyze an image and get a pass/fail result based on the image efficiency and wasted space. Simply set `CI=true` in the environment when invoking any valid dive command.\n\n**Multiple Image Sources and Container Engines Supported**\n\nWith the `--source` option, you can select where to fetch the container image from:\n```bash\ndive \u003cyour-image\u003e --source \u003csource\u003e\n```\nor\n```bash\ndive \u003csource\u003e://\u003cyour-image\u003e\n```\n\nWith valid `source` options as such:\n- `docker`: Docker engine (the default option)\n- `docker-archive`: A Docker Tar Archive from disk\n- `podman`: Podman engine (linux only)\n\n## Installation\n\n**Ubuntu/Debian**\n\nUsing debs:\n```bash\nDIVE_VERSION=$(curl -sL \"https://api.github.com/repos/wagoodman/dive/releases/latest\" | grep '\"tag_name\":' | sed -E 's/.*\"v([^\"]+)\".*/\\1/')\ncurl -fOL \"https://github.com/wagoodman/dive/releases/download/v${DIVE_VERSION}/dive_${DIVE_VERSION}_linux_amd64.deb\"\nsudo apt install ./dive_${DIVE_VERSION}_linux_amd64.deb\n```\n\nUsing snap:\n```bash\nsudo snap install docker\nsudo snap install dive\nsudo snap connect dive:docker-executables docker:docker-executables\nsudo snap connect dive:docker-daemon docker:docker-daemon\n```\n\n\u003e [!CAUTION]\n\u003e The Snap method is not recommended if you installed Docker via `apt-get`, since it might break your existing Docker daemon.\n\u003e \n\u003e See also: https://github.com/wagoodman/dive/issues/546\n\n\n**RHEL/Centos**\n```bash\nDIVE_VERSION=$(curl -sL \"https://api.github.com/repos/wagoodman/dive/releases/latest\" | grep '\"tag_name\":' | sed -E 's/.*\"v([^\"]+)\".*/\\1/')\ncurl -fOL \"https://github.com/wagoodman/dive/releases/download/v${DIVE_VERSION}/dive_${DIVE_VERSION}_linux_amd64.rpm\"\nrpm -i dive_${DIVE_VERSION}_linux_amd64.rpm\n```\n\n**Arch Linux**\n\nAvailable in the [extra repository](https://archlinux.org/packages/extra/x86_64/dive/) and can be installed via [pacman](https://wiki.archlinux.org/title/Pacman):\n\n```bash\npacman -S dive\n```\n\n**Mac**\n\nIf you use [Homebrew](https://brew.sh):\n\n```bash\nbrew install dive\n```\n\nIf you use [MacPorts](https://www.macports.org):\n\n```bash\nsudo port install dive\n```\n\nOr download the latest Darwin build from the [releases page](https://github.com/wagoodman/dive/releases/latest).\n\n**Windows**\n\nIf you use [Chocolatey](https://chocolatey.org)\n\n```powershell\nchoco install dive\n```\n\nIf you use [scoop](https://scoop.sh/)\n\n```powershell\nscoop install main/dive\n```\n\nIf you use [winget](https://learn.microsoft.com/en-gb/windows/package-manager/):\n\n```powershell\nwinget install --id wagoodman.dive\n```\n\nOr download the latest Windows build from the [releases page](https://github.com/wagoodman/dive/releases/latest).\n\n**Go tools**\nRequires Go version 1.10 or higher.\n\n```bash\ngo install github.com/wagoodman/dive@latest\n```\n*Note*: installing in this way you will not see a proper version when running `dive -v`.\n\n**Nix/NixOS**\n\nOn NixOS:\n```bash\nnix-env -iA nixos.dive\n```\nOn non-NixOS (Linux, Mac)\n```bash\nnix-env -iA nixpkgs.dive\n```\n\n**X-CMD**\n\n[x-cmd](https://www.x-cmd.com/) is a **toolbox for Posix Shell**, offering a lightweight package manager built using shell and awk.\n```sh\nx env use dive\n```\n\n**Docker**\n```bash\ndocker pull docker.io/wagoodman/dive\n# or alternatively\ndocker pull ghcr.io/wagoodman/dive\n```\n\nWhen running you'll need to include the Docker socket file:\n```bash\ndocker run --rm -it \\\n    -v /var/run/docker.sock:/var/run/docker.sock \\\n    docker.io/wagoodman/dive:latest \u003cdive arguments...\u003e\n```\n\nDocker for Windows (showing PowerShell compatible line breaks; collapse to a single line for Command Prompt compatibility)\n```bash\ndocker run --rm -it `\n    -v /var/run/docker.sock:/var/run/docker.sock `\n    docker.io/wagoodman/dive:latest \u003cdive arguments...\u003e\n```\n\n**Note:** depending on the version of docker you are running locally you may need to specify the docker API version as an environment variable:\n```bash\n   DOCKER_API_VERSION=1.37 dive ...\n```\nor if you are running with a docker image:\n```bash\ndocker run --rm -it \\\n    -v /var/run/docker.sock:/var/run/docker.sock \\\n    -e DOCKER_API_VERSION=1.37 \\\n    docker.io/wagoodman/dive:latest \u003cdive arguments...\u003e\n```\nif you are using an alternative runtime (Colima etc) then you may need to specify the docker host as an environment variable in order to pull local images:\n```bash\n   export DOCKER_HOST=$(docker context inspect -f '{{ .Endpoints.docker.Host }}')\n```\n\n## CI Integration\n\nWhen running dive with the environment variable `CI=true` then the dive UI will be bypassed and will instead analyze your docker image, giving it a pass/fail indication via return code. Currently there are three metrics supported via a `.dive-ci` file that you can put at the root of your repo:\n```\nrules:\n  # If the efficiency is measured below X%, mark as failed.\n  # Expressed as a ratio between 0-1.\n  lowestEfficiency: 0.95\n\n  # If the amount of wasted space is at least X or larger than X, mark as failed.\n  # Expressed in B, KB, MB, and GB.\n  highestWastedBytes: 20MB\n\n  # If the amount of wasted space makes up for X% or more of the image, mark as failed.\n  # Note: the base image layer is NOT included in the total image size.\n  # Expressed as a ratio between 0-1; fails if the threshold is met or crossed.\n  highestUserWastedPercent: 0.20\n```\nYou can override the CI config path with the `--ci-config` option.\n\n## KeyBindings\n\nKey Binding                                | Description\n-------------------------------------------|---------------------------------------------------------\n\u003ckbd\u003eCtrl + C\u003c/kbd\u003e or \u003ckbd\u003eQ\u003c/kbd\u003e        | Exit\n\u003ckbd\u003eTab\u003c/kbd\u003e                             | Switch between the layer and filetree views\n\u003ckbd\u003eCtrl + F\u003c/kbd\u003e                        | Filter files\n\u003ckbd\u003eESC\u003c/kbd\u003e                             | Close filter files\n\u003ckbd\u003ePageUp\u003c/kbd\u003e or \u003ckbd\u003eU\u003c/kbd\u003e          | Scroll up a page\n\u003ckbd\u003ePageDown\u003c/kbd\u003e or \u003ckbd\u003eD\u003c/kbd\u003e        | Scroll down a page\n\u003ckbd\u003eUp\u003c/kbd\u003e or \u003ckbd\u003eK\u003c/kbd\u003e              | Move up one line within a page\n\u003ckbd\u003eDown\u003c/kbd\u003e or \u003ckbd\u003eJ\u003c/kbd\u003e            | Move down one line within a page\n\u003ckbd\u003eCtrl + A\u003c/kbd\u003e                        | Layer view: see aggregated image modifications\n\u003ckbd\u003eCtrl + L\u003c/kbd\u003e                        | Layer view: see current layer modifications\n\u003ckbd\u003eSpace\u003c/kbd\u003e                           | Filetree view: collapse/uncollapse a directory\n\u003ckbd\u003eCtrl + Space\u003c/kbd\u003e                    | Filetree view: collapse/uncollapse all directories\n\u003ckbd\u003eCtrl + A\u003c/kbd\u003e                        | Filetree view: show/hide added files\n\u003ckbd\u003eCtrl + R\u003c/kbd\u003e                        | Filetree view: show/hide removed files\n\u003ckbd\u003eCtrl + M\u003c/kbd\u003e                        | Filetree view: show/hide modified files\n\u003ckbd\u003eCtrl + U\u003c/kbd\u003e                        | Filetree view: show/hide unmodified files\n\u003ckbd\u003eCtrl + B\u003c/kbd\u003e                        | Filetree view: show/hide file attributes\n\u003ckbd\u003ePageUp\u003c/kbd\u003e or \u003ckbd\u003eU\u003c/kbd\u003e          | Filetree view: scroll up a page\n\u003ckbd\u003ePageDown\u003c/kbd\u003e or \u003ckbd\u003eD\u003c/kbd\u003e        | Filetree view: scroll down a page\n\n## UI Configuration\n\nNo configuration is necessary, however, you can create a config file and override values:\n```yaml\n# supported options are \"docker\" and \"podman\"\ncontainer-engine: docker\n# continue with analysis even if there are errors parsing the image archive\nignore-errors: false\nlog:\n  enabled: true\n  path: ./dive.log\n  level: info\n\n# Note: you can specify multiple bindings by separating values with a comma.\n# Note: UI hinting is derived from the first binding\nkeybinding:\n  # Global bindings\n  quit: ctrl+c\n  toggle-view: tab\n  filter-files: ctrl+f, ctrl+slash\n  close-filter-files: esc\n  up: up,k\n  down: down,j\n  left: left,h\n  right: right,l\n\n  # Layer view specific bindings\n  compare-all: ctrl+a\n  compare-layer: ctrl+l\n\n  # File view specific bindings\n  toggle-collapse-dir: space\n  toggle-collapse-all-dir: ctrl+space\n  toggle-added-files: ctrl+a\n  toggle-removed-files: ctrl+r\n  toggle-modified-files: ctrl+m\n  toggle-unmodified-files: ctrl+u\n  toggle-filetree-attributes: ctrl+b\n  page-up: pgup,u\n  page-down: pgdn,d\n\ndiff:\n  # You can change the default files shown in the filetree (right pane). All diff types are shown by default.\n  hide:\n    - added\n    - removed\n    - modified\n    - unmodified\n\nfiletree:\n  # The default directory-collapse state\n  collapse-dir: false\n\n  # The percentage of screen width the filetree should take on the screen (must be \u003e0 and \u003c1)\n  pane-width: 0.5\n\n  # Show the file attributes next to the filetree\n  show-attributes: true\n\nlayer:\n  # Enable showing all changes from this layer and every previous layer\n  show-aggregated-changes: false\n\n```\n\ndive will search for configs in the following locations:\n- `$XDG_CONFIG_HOME/dive/*.yaml`\n- `$XDG_CONFIG_DIRS/dive/*.yaml`\n- `~/.config/dive/*.yaml`\n- `~/.dive.yaml`\n\n`.yml` can be used instead of `.yaml` if desired.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwagoodman%2Fdive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwagoodman%2Fdive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwagoodman%2Fdive/lists"}