Live data from Hacker News

A 1 KB Docker Container

blog.quickmediasolutions.com

11–20 of 75 posts

Re: A 1 KB Docker Container

#11
post #8

Earlier quoted context omitted.

I think I'm being particularly dense here, but do you mean the proxy is proxying to your tiny 1kb container? If so, what happens to the traffic? Or because the tiny container is running the proxy proxies somewhere else? i.e you're using the presence of a container with a label as configuration for the proxy?

I know, it's a bit difficult to explain and a tad confusing. No, the proxy is not sending any traffic to the container. Rather, the container, by simple virtue of being in the running state, tells the proxy to send requests to the domain specified by the label on the container.

[deleted]

Re: A 1 KB Docker Container

#15
post #10

If you want to reduce the size more, try emitting a single layer as a tarball which you can pipe to docker load. That will reduce your layer count to one, plus you can omit a bunch of the metadata that Docker includes when you build from a Dockerfile (it doesn't seem to care at runtime). https://github.com/moby/moby/blob/master/image/spec/v1.md

Indeed.

Another useful technique, which has been recently introduced, is Multi-Stage Builds https://docs.docker.com/engine/userguide/eng-image/multistag... . This lets you avoid putting tools needed for compilation into the final image.

Re: A 1 KB Docker Container

#16
post #13

The smallest useful container I know of is 129B. It was created to test how many containers docker can spin up while reducing the overhead of what was in the container itself. tianon/sleeping-beauty latest 2e8193709fa7 6 months ago 129B https://github.com/tianon/dockerfiles/tree/master/sleeping-b...

Interesting. Incidentally,

> It was created to test how many containers docker can spin up

What was the answer? I'd think on the order of 200-300 on a server with 64 GB of RAM. (Pure guess!)

Re: A 1 KB Docker Container

#19
post #3

Another example of a really small container that doesn't do much, but is made without using assembly directly is the Docker "hello-world". It's built from C without linking in libc: https://github.com/docker-library/hello-world/blob/master/he... I always thought this was a bit misleading. A "hello world" container is 1 kB, but the bare minimum container that does something useful in practice is rarely less than 100 M…

> but the bare minimum container that does something useful in practice is rarely less than 100 MB in size.

I’ve made containers using code written in most common programming languages (python/go/ruby/c/rust/heck even PHP/etc) which were easily under 100mb, most significantly less. If your containers are frequently >100mb, I say you’re either using the JVM or are doing it wrong!

Re: A 1 KB Docker Container

#20
post #3

Another example of a really small container that doesn't do much, but is made without using assembly directly is the Docker "hello-world". It's built from C without linking in libc: https://github.com/docker-library/hello-world/blob/master/he... I always thought this was a bit misleading. A "hello world" container is 1 kB, but the bare minimum container that does something useful in practice is rarely less than 100 M…

Well you can throw static builds of useful go programs which can very well be smaller than 100MB on docker scratch images. :)
Post reply on HN