TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A 1 KB Docker Container

216 点作者 nathan-osman超过 7 年前

16 条评论

thebsdbox超过 7 年前
As part of a competition before the last DockerCon I managed to get a container down to 69B<p>Details: <a href="http:&#x2F;&#x2F;thebsdbox.co.uk&#x2F;in-pursuit-of-a-tinier-binary-er&#x2F;" rel="nofollow">http:&#x2F;&#x2F;thebsdbox.co.uk&#x2F;in-pursuit-of-a-tinier-binary-er&#x2F;</a><p>Code: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;thebsdbox&#x2F;29e395299f89b52214b66269f5b33f7d" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;thebsdbox&#x2F;29e395299f89b52214b66269f5...</a>
评论 #15364409 未加载
评论 #15387915 未加载
评论 #15366923 未加载
ffk超过 7 年前
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.<p>tianon&#x2F;sleeping-beauty latest 2e8193709fa7 6 months ago 129B<p><a href="https:&#x2F;&#x2F;github.com&#x2F;tianon&#x2F;dockerfiles&#x2F;tree&#x2F;master&#x2F;sleeping-beauty" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tianon&#x2F;dockerfiles&#x2F;tree&#x2F;master&#x2F;sleeping-b...</a>
评论 #15363462 未加载
avian超过 7 年前
Another example of a really small container that doesn&#x27;t do much, but is made without using assembly directly is the Docker &quot;hello-world&quot;. It&#x27;s built from C without linking in libc:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;docker-library&#x2F;hello-world&#x2F;blob&#x2F;master&#x2F;hello.c" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;docker-library&#x2F;hello-world&#x2F;blob&#x2F;master&#x2F;he...</a><p>I always thought this was a bit misleading. A &quot;hello world&quot; container is 1 kB, but the bare minimum container that does something useful in practice is rarely less than 100 MB in size.
评论 #15363298 未加载
评论 #15363566 未加载
评论 #15363506 未加载
评论 #15363277 未加载
arianvanp超过 7 年前
We already have a portable container format for executables with no dependencies... It&#x27;s called an ELF binary... Why would you even put a static binary in a container in the first place? I don&#x27;t get it.
评论 #15366984 未加载
评论 #15366466 未加载
评论 #15366135 未加载
评论 #15366958 未加载
adlpz超过 7 年前
This is of course pretty pointless, I mean it&#x27;s neat but all these tiny containers don&#x27;t really <i>do</i> anything so it isn&#x27;t much more than a cool trick.<p>However there is a great lesson to take from this: you <i>can</i> create single-binary but really useful containers for just a few MBs, which is nothing in practice for a usual sized server, an a lot more lightweight than usual containers based off Alpine or Ubuntu.<p>In fact I run my static websites using that: a small 8-ish MB statically compiled web server &quot;written&quot; (it&#x27;s really just library glue) in Go.
评论 #15364281 未加载
brobinson超过 7 年前
I have one that is 344 bytes: <a href="https:&#x2F;&#x2F;github.com&#x2F;dseevr&#x2F;cpu_consumer" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dseevr&#x2F;cpu_consumer</a><p>It just runs a tight loop that consumes an entire core.
评论 #15363580 未加载
darren0超过 7 年前
Container in a (240 character) tweet <a href="https:&#x2F;&#x2F;twitter.com&#x2F;thaJeztah&#x2F;status&#x2F;913378165124423680" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;thaJeztah&#x2F;status&#x2F;913378165124423680</a><p>Replace -d with -D for macOS
ttwwmm超过 7 年前
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&#x27;t seem to care at runtime).<p><a href="https:&#x2F;&#x2F;github.com&#x2F;moby&#x2F;moby&#x2F;blob&#x2F;master&#x2F;image&#x2F;spec&#x2F;v1.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;moby&#x2F;moby&#x2F;blob&#x2F;master&#x2F;image&#x2F;spec&#x2F;v1.md</a>
评论 #15363441 未加载
userbinator超过 7 年前
Notice that the executable itself contains less than 100 bytes of instructions, but the file is still 736 bytes. Even without optimising the Asm itself (I can see at least 2-3 bytes improvement at a glance), that could probably be reduced even further:<p><a href="http:&#x2F;&#x2F;www.muppetlabs.com&#x2F;~breadbox&#x2F;software&#x2F;tiny&#x2F;teensy.html" rel="nofollow">http:&#x2F;&#x2F;www.muppetlabs.com&#x2F;~breadbox&#x2F;software&#x2F;tiny&#x2F;teensy.htm...</a><p>736B may seem tiny to most people, but if you&#x27;re working in Asm that&#x27;s a lot --- there&#x27;s plenty of interesting things (beyond &quot;call the OS a few times&quot;) the demoscene has done with smaller binaries; here&#x27;s an assortment of 512B ones:<p><a href="http:&#x2F;&#x2F;www.pouet.net&#x2F;prodlist.php?type[]=512b" rel="nofollow">http:&#x2F;&#x2F;www.pouet.net&#x2F;prodlist.php?type[]=512b</a>
siscia超过 7 年前
I developed a little side project that aimed to be a serveless open source alternative, it is called effe and uses go as main language.<p>The whole idea is to compile a go program and put it into a docker container and have it listening to the network for a single HTTP endpoint.<p>It is interesting because an useful images come to be less than 6MB :)<p>Link to the project: <a href="https:&#x2F;&#x2F;github.com&#x2F;siscia&#x2F;effe-tool" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;siscia&#x2F;effe-tool</a>
nemasu超过 7 年前
Reminded me of people making docker containers out of this: <a href="https:&#x2F;&#x2F;github.com&#x2F;nemasu&#x2F;asmttpd" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nemasu&#x2F;asmttpd</a><p>eg. <a href="https:&#x2F;&#x2F;hub.docker.com&#x2F;r&#x2F;0xff&#x2F;asmttpd&#x2F;" rel="nofollow">https:&#x2F;&#x2F;hub.docker.com&#x2F;r&#x2F;0xff&#x2F;asmttpd&#x2F;</a><p>7KB web server container.
评论 #15364152 未加载
pbiggar超过 7 年前
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&#x27;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?
jzelinskie超过 7 年前
For reference, Kubernetes uses a `pause`[0] for a similar reason.<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;kubernetes&#x2F;kubernetes&#x2F;tree&#x2F;master&#x2F;build&#x2F;pause" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kubernetes&#x2F;kubernetes&#x2F;tree&#x2F;master&#x2F;build&#x2F;p...</a>
Varcht超过 7 年前
OT, what&#x27;s the smallest windows&#x2F;.net containers out there? I have some legacy stuff I&#x27;d like to dockerize but they end up so big and slow to deploy. I&#x27;ve just been rewriting them.
maruhan2超过 7 年前
Im not familiar with dockers so bear with me, but why is another container needed for the reverse proxy?
评论 #15363264 未加载
daviesgeek超过 7 年前
This was a really fascinating read. Enjoyed it thoroughly