Live data from Hacker News

A 1 KB Docker Container

blog.quickmediasolutions.com

21–30 of 75 posts

Re: A 1 KB Docker Container

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

What happens if the container isn't running?

Re: A 1 KB Docker Container

#23
post #6

Earlier quoted context omitted.

If you base off alpine, you can get useful containers quite a lot smaller than 100MB. One example i use is an agent i deploy to kubernetes clusters to do some security scanning. The scripts are ruby and the image clocks in at 9MB compressed https://hub.docker.com/r/raesene/kaa-agent/tags/

Yes, I use Alpine for a lot of my other containers. I love the simplicity of the package manager as well.

Alpine's package manager has the great property that you don't need to update the index in order to fetch a package IIRC; the whole `apt-get update && apt-get install && ` dance is quite tedious in debian-based Docker containers.

Re: A 1 KB Docker Container

#24
I did a similar thing, using a tiny executable that someone else had made. However, even though the container was around 100 bytes, I couldn't make a container that was smaller than some much larger number, maybe 512kb? This was in 2015, so maybe that limit has changed - any docker folks know anything about this?

Re: A 1 KB Docker Container

#25

Earlier quoted context omitted.

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.

What happens if the container isn't running?

Then the proxy will not route requests to the host specified by the container's label.

Re: A 1 KB Docker Container

#26
post #23

Earlier quoted context omitted.

Yes, I use Alpine for a lot of my other containers. I love the simplicity of the package manager as well.

Alpine's package manager has the great property that you don't need to update the index in order to fetch a package IIRC; the whole `apt-get update && apt-get install && ` dance is quite tedious in debian-based Docker containers.

No, you still need to, but there's a compact syntax for it that will update and discard the index in a single 'add' command. It's unavoidable - somewhere some querying is happening in order map the package name/ver to a download link.

Re: A 1 KB Docker Container

#27
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!)

That is very low. The current official limitation in OpenShift (a Kubernetes distro) is 250 but there have been lab clusters which have gone higher.

Re: A 1 KB Docker Container

#28
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!)

Depends on several other variables.

If you use default docker options, you'll be creating a veth pair per container. You might run into a limit there at around 1024 containers. You also might hit ulimit if your system isn't well configured.

If you use --net=none, you won't hit that issue, and you'll probably be able to manage quite a few

The resource usage ends up being roughly 4 bytes rss for the executable in the container and around 3.5MB for the "containerd-shim" go binary that parents the container.

"containerd" and "dockerd" both probably have a little extra resource usage per container they're managing, but I'd guess that's on the order of about 200KB per at most.

The next big limit you'll hit is the process/pid limit (/proc/sys/kernel/pid_max) which defaults to 32k.

Fortunately, due to the memory overhead of a bit under 4MB, you probably won't get there on your 64GB of ram server and might cap out at around 15k containers total.

Experimentally, my linux laptop (running docker 17.06) is able to run 1100 copies of that sleeping-beuaty container using almost exactly 2GB RSS additional memory and no noticeable additional cpu

This is even better than I calculated above, possibly due to shared memory for containerd-shim. I'm not investigating further.

Re: A 1 KB Docker Container

#29
post #27

Earlier quoted context omitted.

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!)

That is very low. The current official limitation in OpenShift (a Kubernetes distro) is 250 but there have been lab clusters which have gone higher.

There are articles about running 2500 web server containers on a raspberry pi :)
Post reply on HN