TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Dive: A tool for exploring a Docker image, layer contents and more

464 pointsby tomas789over 1 year ago

18 comments

miquongover 1 year ago
For image and layer manipulation, crane is awesome - as is the underlying go-containerregistry library.<p>It lets you add new layers, or edit any metadata (env vars, labels, entrypoint, etc) in existing images. You can also &quot;flatten&quot; an image with multiple layers into a single layer. Additionally you can &quot;rebase&quot; an image (re-apply your changes onto a new&#x2F;updated base image). It does all this directly in the registry, so no docker needed (though it&#x27;s still useful for creating the original image).<p><a href="https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;go-containerregistry&#x2F;blob&#x2F;main&#x2F;cmd&#x2F;crane&#x2F;recipes.md">https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;go-containerregistry&#x2F;blob&#x2F;main&#x2F;cmd...</a><p>(updated: better link)
评论 #38921939 未加载
评论 #38916961 未加载
notatoadover 1 year ago
I found dive super useful for understanding how docker images work, and how to write efficient dockerfiles. Reading the docs is one thing, but making a change to the dockerfile and then seeing how it has affected the resulting layer structure is what really made me get it.
runfaster2000over 1 year ago
Dive is great. Tools like that are critical for both learning and developing confidence on what you are precisely building&#x2F;shipping.<p>Dredge is another tool to look at. I use it for diffing layers.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;mthalman&#x2F;dredge&#x2F;blob&#x2F;main&#x2F;docs&#x2F;commands&#x2F;images.md#compare-image-layers">https:&#x2F;&#x2F;github.com&#x2F;mthalman&#x2F;dredge&#x2F;blob&#x2F;main&#x2F;docs&#x2F;commands&#x2F;i...</a>
评论 #38915329 未加载
maxlohover 1 year ago
A dumb question: Why are most of the container&#x2F;infrastructure tools written in GoLang?<p>Examples that come to my mind include Docker, Podman, nerdctl, Terraform and Kubernetes.<p>Is there any obvious advantage that GoLang offers, making it so popular for building these tools?
评论 #38917670 未加载
评论 #38920108 未加载
评论 #38920430 未加载
评论 #38918263 未加载
评论 #38917673 未加载
TechIsCoolover 1 year ago
I love dive and its something that I use in my tool kit multiple times a month.<p>I am curious if anyone knows how to get the contents of the file you have highlighted, a lot of the times I use dive to validate that a file exists in a layer and then I want to peak at it. Currently I normally revert to running the container and using cat or extracting the contents and then wandering into the folders.
评论 #38930272 未加载
indroraover 1 year ago
Dive has saved my ass so many times it&#x27;s not funny when trying to pull apart what various common docker containers do when I&#x27;m extending them.<p>A+ software.
diazcover 1 year ago
There’s other great TUI terminal tools like dive here [0], lazydocker and dry come to mind.<p>And some in the docker category as well:<p>[0] <a href="https:&#x2F;&#x2F;terminaltrove.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;terminaltrove.com&#x2F;</a>
评论 #38915405 未加载
kylegalbraithover 1 year ago
Dive is an amazing tool in the container&#x2F;Docker space. It makes life so much easier to debug what is actually in your container. When we were first getting started with Depot [0], we often got asked how to reduce image size as well as make builds faster. So we wrote up a quick blog post that shows how to use Dive to help with that problem [1]. It might be a bit dated now, but in case it helps a future person.<p>Dive also inspired us to make it easier to surface what is actually in your build context, on every build. So we shipped that as a feature in Depot a few weeks back.<p>[0] <a href="https:&#x2F;&#x2F;depot.dev">https:&#x2F;&#x2F;depot.dev</a><p>[1] <a href="https:&#x2F;&#x2F;depot.dev&#x2F;blog&#x2F;reducing-image-size-with-dive">https:&#x2F;&#x2F;depot.dev&#x2F;blog&#x2F;reducing-image-size-with-dive</a><p>[2] <a href="https:&#x2F;&#x2F;depot.dev&#x2F;blog&#x2F;build-context">https:&#x2F;&#x2F;depot.dev&#x2F;blog&#x2F;build-context</a>
eris_agxover 1 year ago
Other than being super useful, Dive has an underrated feature: its author is a great developer and very fun to work with.
sureglymopover 1 year ago
There&#x27;s a tool from google called container-diff that&#x27;s also really useful!<p>I use it to see what random scripts one is encouraged to pipe into bash would do to a system.
评论 #38922571 未加载
tonymetover 1 year ago
Dive is a gem. It&#x27;s helped me find a lot of cruft ...<p>- unneeded build dependencies. Used a scratch image and&#x2F;or removed build deps in the same step - node_modules for dev-deps . Used prod - Embeded Chromium builds (with puppetteer). Removed chromium and remoted an external build<p>Docker desktop now has this feature built in, but I&#x27;ve been using dive for years to find wasted space &amp; potential security issues.
oooyayover 1 year ago
Dive is incredible, it saved my butt numerous times and taught me a lot about layers. It&#x27;s so good that Docker Desktop emulated its functionality.
radusover 1 year ago
Great tool, I use it with this alias:<p><pre><code> alias dive=&#x27;docker run -ti --rm -v &#x2F;var&#x2F;run&#x2F;docker.sock:&#x2F;var&#x2F;run&#x2F;docker.sock wagoodman&#x2F;dive&#x27; </code></pre> (as suggested in project the README)
vbezhenarover 1 year ago
What&#x27;s the reason docker uses tar archives instead of ordinary directories for layer contents? This tool is great but it fixes something that should not exist in the first place.
评论 #38916807 未加载
animeshjainover 1 year ago
I used dive when I was trying to cut down on the size of the image. Diffing and seeing what files&#x2F;directories go into each layer was very useful.
a_t48over 1 year ago
Dive is great. It struggles a bit with very very large images but beyond that no real complaints.
tornadofartover 1 year ago
What exactly is meant by a layer?
评论 #38915193 未加载
评论 #38915166 未加载
greenie_beansover 1 year ago
this helped me debug a docker thing recently, very handy tool!