Live data from Hacker News

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

github.com

61–62 of 62 posts

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

#61

I love dive and its something that I use in my tool kit multiple times a month. 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.

You can use rsync with some magic to get at the files, but it's not much removed from using cat.

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

#62
post #22
post #15

For image and layer manipulation, crane is awesome - as is the underlying go-containerregistry library. It lets you add new layers, or edit any metadata (env vars, labels, entrypoint, etc) in existing images. You can also "flatten" an image with multiple layers into a single layer. Additionally you can "rebase" an image (re-apply your changes onto a new/updated base image). It does all this directly in the registry,…

Is there any performance benefit to having fewer layers? My understanding is that there's no gain by merging layers as the size of the image remains constant.

One simple case where the resulting image is bigger than necessary:

``` COPY ./package.deb /tmp/package.deb

RUN dpkg -i /tmp/*.deb && rm -rf /tmp/*.deb ```

This results in two layers, with one layer containing a huge file, thus being part of the final image if you don't do multi-stage builds.

Post reply on HN