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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: Bocker – Docker implemented in 100 lines of bash

662 点作者 p8952将近 10 年前

26 条评论

tobbyb将近 10 年前
Just playing with this in a VM with an attached btrfs volume, a complete revelation. 96 lines! And it&#x27;s actually pretty functional. This takes keeping it simple to a whole new level.<p>The Wheezy image I use with LXC worked well enough, the minimal alpine image not so well, apk complaining about its database.<p>User name spaces support would be nice, then we can play with unprivileged containers.<p>And Overlayfs would be a nifty alternative to btrfs, it&#x27;s in kernel 3.18, and 4.04 adds support for multiple lower layers. But this btrfs implementation is cool too. Cgroups support will be somewhere on that list too.<p>Cgroups and namespaces is in the kernel. General Linux ecosystem for networking, storage and distributed systems is already extensive. The possibilities are endless.<p>So now LXC, Docker, Rkt and Nspawn have Bocker for company.
评论 #9933964 未加载
评论 #9933954 未加载
vezzy-fnord将近 10 年前
Using btrfs subvolumes as the image format, that&#x27;s a nice touch. On the same road as the hypothetical systemd packaging system (not that I&#x27;m very enthusiastic about that).<p>The network, PID and mount namespaces are the ones unshared, plus a private &#x2F;proc.<p>I like tools like this because they&#x27;re reality checks on how the basics of Linux containers are just a few essential system calls, and particularly that they&#x27;re limited.
评论 #9926509 未加载
评论 #9926494 未加载
评论 #9927319 未加载
tlrobinson将近 10 年前
Here&#x27;s a proof-of-concept implementation of &quot;docker pull&quot; in bash (YMMV, I think it has broken since I wrote it): <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;tlrobinson&#x2F;c85dca269f4405ad4201" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;tlrobinson&#x2F;c85dca269f4405ad4201</a>
评论 #9926534 未加载
评论 #9928777 未加载
anh79将近 10 年前
When I first saw the HN title, I was so stunning. Weird, it&#x27;s not my tool <a href="https:&#x2F;&#x2F;github.com&#x2F;icy&#x2F;bocker" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;icy&#x2F;bocker</a> ;)<p>The author of &quot;bocker&quot; (not my bocker) has a great idea. I would learn from the script. Docker is not magic anymore.!!
eatitraw将近 10 年前
Now we need bokku: <a href="https:&#x2F;&#x2F;github.com&#x2F;progrium&#x2F;dokku" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;progrium&#x2F;dokku</a>
评论 #9927042 未加载
tzm将近 10 年前
$10M per LoC
WD-42将近 10 年前
Nice work. Great to see the advanced features of BTRFS put to use.
评论 #9926485 未加载
asdfaoeu将近 10 年前
There&#x27;s also <a href="https:&#x2F;&#x2F;github.com&#x2F;docker&#x2F;dockerlite" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;docker&#x2F;dockerlite</a> . But not sure how current it is.
sandGorgon将近 10 年前
not sure if you ever saw this - <a href="https:&#x2F;&#x2F;www.phoronix.com&#x2F;scan.php?page=news_item&amp;px=CoreOS-Btrfs-To-EXT4-OverlayFS" rel="nofollow">https:&#x2F;&#x2F;www.phoronix.com&#x2F;scan.php?page=news_item&amp;px=CoreOS-B...</a><p>it might be interesting to see a version of your script using overlayfs
评论 #9926470 未加载
评论 #9927678 未加载
arianvanp将近 10 年前
Add support for GPG-signed `btrfs pull` and `btrfs push` and I&#x27;m totally sold! I&#x27;ve been working on something similar to this but on top of systemd-nspawn, which already does some stuff for you.<p>systemd-nspawn is nice because I run systemd in all my containers and thus allows me to easily do logging etc.<p>I don&#x27;t really dig the docker-microservices mantra that much. I just use them as glorified VMs I guess.<p>(And yes, you should run an init system in your containers [0])<p>[0] - <a href="https:&#x2F;&#x2F;blog.phusion.nl&#x2F;2015&#x2F;01&#x2F;20&#x2F;docker-and-the-pid-1-zombie-reaping-problem&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.phusion.nl&#x2F;2015&#x2F;01&#x2F;20&#x2F;docker-and-the-pid-1-zomb...</a>
Bocker将近 10 年前
Approved.
joeevans1000将近 10 年前
The emperor is wearing fewer clothes.
jenscow将近 10 年前
That script is the best description of Docker I&#x27;ve read.
spydum将近 10 年前
I&#x27;m missing something, what actually &quot;executes&quot; the command here echo &quot;$2&quot; &gt; &quot;$btrfs_path&#x2F;$uuid&#x2F;$uuid.cmd&quot;<p>Is something watching for .cmd? Is this some behavior of util-linux (for which, my few seconds couldn&#x27;t find solid documentation on)?
评论 #9927567 未加载
e12e将近 10 年前
Nice. As I just started playing with zfsonlinux, I&#x27;m tempted to &quot;port&quot; this from btrfs to zfs... Should allow for migrating &quot;images&quot;&#x2F;snapshots with zfs send...
kzisme将近 10 年前
As an entry level developer - how does someone go about re-writing &quot;x&quot; in 100 lines of &quot;x&quot;?<p>Is there a certain process that goes into developing something like this, and why is this a popular thing to do? (writing an existing software in lesser lines)
评论 #9929501 未加载
cyansmoker将近 10 年前
Hey, I just submitted a pull request for the &quot;exec&quot; command :)
agumonkey将近 10 年前
Persistent data structure FTW.
amrit_b将近 10 年前
This is incredible.
logicrime将近 10 年前
Holy crap! I&#x27;ve been keeping up with the hype, yet having never used Docker and never needed it yet I can&#x27;t help but become more skeptical now that I know that it&#x27;s features aren&#x27;t more complex than a little bit of bash.<p>People give bash a hard time, but things like this really give me that warm, fuzzy feeling.<p>esac4lyfe
评论 #9926991 未加载
评论 #9927421 未加载
评论 #9934854 未加载
sklogic将近 10 年前
I honestly thought docker was just a little script when I saw it first, judging on the functionality.
BonoboBoner将近 10 年前
You published it? You should have gotten a &quot;micro-docker&quot;-like hashtag trend going and then pitch your idea to VCs. The main &quot;Lighter than Docker&quot; startup would be valued at around 5-7 billion right now.
评论 #9928118 未加载
评论 #9928116 未加载
vacri将近 10 年前
Interesting work. And 10% of those lines are simply closing braces which can be collapsed to the previous line, and half a dozen lines can be reclaimed from the help function...
SFjulie1将近 10 年前
I thought puppet&#x2F;chef were the pit of the devops ridicule. Then I not only saw this, but also positive reactions to a readable code in which you have :<p><pre><code> echo &#x27;nameserver 8.8.8.8&#x27; &gt; &quot;$btrfs_path&#x2F;$uuid&quot;&#x2F;etc&#x2F;resolv.conf </code></pre> This is wrong on so many level that I don&#x27;t know where to begin with.
评论 #9927686 未加载
评论 #9927845 未加载
评论 #9927670 未加载
pekk将近 10 年前
Wow, Docker in 100 lines! It runs as root? Oh. It is written in bash? Oh. It needs a ton of manual setup? Oh. It doesn&#x27;t actually implement the package format which is most of the point of Docker? Oh. So is it that easy to reimplement Docker? Despite the obvious snarky intent, it appears not.
评论 #9927652 未加载
npx将近 10 年前
If anyone wants to earn some huge brownie points with me (and who wouldn&#x27;t), you could implement a PaaS on top of Joyent&#x27;s Triton system[1]. Purely in terms of the cost structure you could offer with such a PaaS, this could be a Heroku killer. Huge bonus points if it&#x27;s totally open source!<p>1. <a href="https:&#x2F;&#x2F;github.com&#x2F;joyent&#x2F;sdc-docker" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;joyent&#x2F;sdc-docker</a>