Live data from Hacker News

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

github.com

31–40 of 62 posts

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

#31
post #21

A dumb question: Why are most of the container/infrastructure tools written in GoLang? Examples that come to my mind include Docker, Podman, nerdctl, Terraform and Kubernetes. Is there any obvious advantage that GoLang offers, making it so popular for building these tools?

when you run containers, you want to care as little about the underlying system as possible, and go makes it easy to be in its own little world.

plus ecosystem effects of you can just use the packages of a different implementation for part of your code.

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

#32
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.

Eventually, once zstd support gets fully supported, and tiny gzip compression windows are not a limitation, then compressing a full layer would almost certainly have a better ratio over several smaller layers

https://github.com/opencontainers/image-spec/issues/803

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

#33
post #30
post #21

A dumb question: Why are most of the container/infrastructure tools written in GoLang? Examples that come to my mind include Docker, Podman, nerdctl, Terraform and Kubernetes. Is there any obvious advantage that GoLang offers, making it so popular for building these tools?

I think I can answer for Docker. The first prototype was written in Python, the company was a Python shop. The main reason for a rewrite in Go was to ride the popularity of Go that was growing at the time (2012). source: I was there.

In hindsight, docker is probably much better off with Go, considering the use case. And I say that as someone who loves python and isn't too much into go!

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

#34
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.

Less performance and more security. Lots of ameteur images use a secret file or inadvertently store a secret to a layer without realizing an rm or other process in another layer doesn't actually eliminate it. If the final step of your build squashes the filesystem flat again you can remove a lot of potentially exposed metadata and secrets stored in intermediate layers

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

#35
post #21

A dumb question: Why are most of the container/infrastructure tools written in GoLang? Examples that come to my mind include Docker, Podman, nerdctl, Terraform and Kubernetes. Is there any obvious advantage that GoLang offers, making it so popular for building these tools?

Kubernetes specifically is in go because google invented go and also invented Kubernetes. Their internal teams have a lot of go engineers due to the whole inventing it thing

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

#36
post #23
post #22

Earlier quoted context omitted.

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.

some startup performance savings in fewer http requests to fetch the image. small for sure but it's something?

Depends. If you would have to fetch a big layer often because of updates, that's not good. But if what is changing frequently is in a smaller layer, it will be more favorable

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

#37
post #21

A dumb question: Why are most of the container/infrastructure tools written in GoLang? Examples that come to my mind include Docker, Podman, nerdctl, Terraform and Kubernetes. Is there any obvious advantage that GoLang offers, making it so popular for building these tools?

Kubernetes specifically is in go because google invented go and also invented Kubernetes. Their internal teams have a lot of go engineers due to the whole inventing it thing

I believe the original Kubernetes proof of concept was written in Java

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

#38
post #30

Earlier quoted context omitted.

I think I can answer for Docker. The first prototype was written in Python, the company was a Python shop. The main reason for a rewrite in Go was to ride the popularity of Go that was growing at the time (2012). source: I was there.

In hindsight, docker is probably much better off with Go, considering the use case. And I say that as someone who loves python and isn't too much into go!

> In hindsight, docker is probably much better off with Go, considering the use case. And I say that as someone who loves python and isn't too much into go!

Same. I use docker to escape the versioning hell that is modern python.

When you're trying to build a tool, the more self-contained the better.

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

#39
post #21

A dumb question: Why are most of the container/infrastructure tools written in GoLang? Examples that come to my mind include Docker, Podman, nerdctl, Terraform and Kubernetes. Is there any obvious advantage that GoLang offers, making it so popular for building these tools?

Easiest language to (cross-)compile and distribute, stellar productivity to performance ratio, native (uncolored) concurrency, great networking capabilities in the stdlib. Imagine if you will Docker and Kubernetes written in any of the other popular languages.

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

#40
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.

I'm working on a tool that does the opposite: to split layers into smaller, deterministic deltas.
Post reply on HN