543 points · by sturza · 6y ago · 196 comments
wget https://bla/image.tgz
tar xzf image.tgz
rm image.tgz
chroot image/start
and the product would be installed and up & running. A lot of clients thought it was magic. No Apache install? No MySQL install?? It works on Fedora & Centos & Debian & Ubuntu & ... ?I use this currently still a lot to run new software on unsupported hardware/kernels. For instance, I run a lot of new (Ubuntu) software on my OpenPandora under the default OS on that device; I have an SD with a chroot with Ubuntu and things like dotnet core. Runs fine. Gives devices like that a second youth.
On top of all this, they designed a new programming language / build system for making those tar files. They invented a container registry so that instead of just "downloading a file", you have to use their particular protocol to download a file. They have their own version of systemd so you can see what programs are running. They tacked on some very complicated networking stuff. They tried to build a couple of container orchestration frameworks on top of all this. I think all the "extra stuff" is where people run into problems, and it's isn't even the core of the value it provides.
People have realized that it's all a little much and the good bits have been distilled into their own projects. Many build systems can just generate an OCI registry file directly (remember, it's just a tar file, and you don't need all that 1970s JCL stuff to make a tar file). Various runtimes (containerd/CRI-O) exist for running containers. And there are orchestration layers on top, for actually managing sets of containers, network rules, etc. (ECR, Kubernetes, etc.).
(Worth noting is that Docker itself does use all these spin-offs. It uses containerd as the runtime, it uses buildkit for building containers now, etc. They even ship a Kubernetes distribution, at least on Mac and Windows.)
Basically, "it's just chroot with [tons of useful features]"
Docker allows the programmer to write more code to build and maintain their environment, cutting the system administrator out of the loop; the sysadmin just has to provide a server able to run generic Docker containers, and doesn’t have to care about what’s in them.
Basically it’s a bit of a power grab, and a bit of developers being upset about slow processes in their companies (“why does it take two weeks to deploy a new version of this dependency”) and finding a workaround. Then the rest of the world started cargo-culting them.
In my experience, systemd-nspawn provides a nice alternative. It's mainly a chroot that abstracts the low-level details, and it fixes some security concerns (with cgroups, etc) and adds some nice features: e.g. networking, or `systemctl status` from the host that will display the sub-tree for the processes of the sub-host.
I was left puzzled.
The only time this is reasonable is when a container needs to manage services on the host a la what Portainer does for Docker.
You have a lot of options for accomplishing what you want.
* To run a service with a given root filesystem add RootFilesystem=/path to your unit file.
* Run a service from an image of a root filesystem use systemd portable services.
* To run your service using the init system in your root filesystem (could be systemd but doesn't have to be) use systemd-nspawn --boot.
1. Put files on a device
2. Start a process
The scale at which containerised scheduling of this outcome saves more time than it consumes is much higher than many have been led to believe. I measure it in sysadmin FTE. If you have >0.5 FTE dedicated to managing deployments then there may be a payoff, because (amortized over a reasonable period e.g. 12 months) it takes at minimum half an FTE to setup, manage, and maintain a PaaS properly.
I've become accustomed to folks claiming things like, "I spend 5 minutes a week managing my kubernetes cluster". Then it turns out it took them a solid month to get it going properly, two weeks to containerise their application reliabily, and then next quarter they're stuck for days on some weird networking or logging issue, and nothing else progresses. Basically, they either don't value their time, or they're misjudging how much they've actually allocated.
It's often the same people who boast about how cheap their bare-metal servers are vs public cloud instances.
In these distributions, you have tools ("pbuilder/*builder" in deb base distributions, "mock" in rpm based distributions) which create a chroot, grabs the build dependencies and install them from the repo, build the package and then throw away the chroot.
It's really convenient for many reasons:
1) tracking and referencing build dependencies is far better as you have to declare them explicitly, no more "but it used to compile on the old machine... what am I missing".
2) you don't add kludge on the host running the build as you start from a fresh chroot every time.
3) you can target many distributions/versions from one building host (I'm regularly building RHEL 7 and 8 rpms and Debian 7, 8, 9, 10 debs from my Debian sid for example, without too much worry of weird side effects due to my particular setup.
The downside is that builds can take a bit more time, but that's clearly something I'm willing to trade-off for more systematic and (semi-)reproducible builds.
I even spent a few nights a month ago to have a newer version of mock that supports EL8 available on my Debian (for those interested: https://github.com/kakwa/debian-rpm-build-tools)
We should never forget that at the root of containerization is a desire to keep everyones shit sorted. That's been a Unix thing forever.
EDIT: "Gives devices like that a second youth."
Hell yeah, long live the OP!
That's literally the point of operating systems: To allow many people to share the resources of one machine without being able to interfere with each other. Modern containers and VMs are just reinventing operating systems, and unfortunately they're doing it on top of existing operating systems rather than building -- you know -- a better operating system.
I feel I don't know enough to see the issues with an approach like that, or know why it's not already mainstream.
You can make a "spectrum" of environments where you run code. One one side is everything running on a single server in a single OS, on the right is everything having its own machine and OS. In between you have chroot, docker, blade servers, virtual machines, and other isolation techniques. chroot falls somewhere between everything running in one system, and everything running in docker containers on one system.
Just wanted to point out that this is true for Docker containers as well.
Something that has actually come in handy from time to time trying to diagnose things.
I think from within the container you can only see that container's processes, but outside (as root) you can see all processes, even those inside the container.
Unless you make your Dockerfiles `FROM scratch` you do have an OS too.
Vulnerabilities in libc (eg: dns resolver) bundled Sendmail, databases... They can be independently patched (good) or they can be independently left on ancient unpatched versions (bad).
If you use the system/distro library services, it can be easier to verify patch levels and know if any given hole (eg this week's sudo hole) affect your system or not.
Also... can someone weigh in on why the likes of Linux VServer and OpenVZ became dormant??
After KVM appeared, it was a little better, so people who were already using it continued to do so.
FreeBSD is probably used to serve more data over the internet than any other OS distribution. All Netflix streams go through FreeBSD.
So yeah, still going strong.
[[ $# -gt 0 ]] && while [ "${1:0:2}" == '--' ]; do OPTION=${1:2}; [[ $OPTION =~ = ]] && declare "BOCKER_${OPTION/=*/}=${OPTION/*=/}" || declare "BOCKER_${OPTION}=x"; shift; done
If the ambition is to write lines like this, you can make it into ~1 line of code.Just because something doesn't follow general rules for readable code, doesn't mean it is actually unreadable.
I can definitely guess the pattern and I do write bash regularly, but I see at least 2 things I'd need to double-check the man page for the behaviour.
Heck, by this definition i'm not sure any code is really good enough. In my job i have to write php daily, i still need to regularly look at docs to figure out order of arguments for various library functions. I wouldn't be able to tell if explode($a, $b) in php has the right argument order at a glance without looking it up. But i understand the intent and generally assume the superficial aspects of the code are right unless that part appears not to work.
And furthermore, adjusting the number of newlines isn't going to help with the question of if that piece of code is using bash syntax correctly.
Perl gets a lot of flak for being unreadable, but I personally have more difficulty understanding bash code than perl (not implying that perl is super readable).
for (i = 0; i < argc && (arg = argv[i]).startswith("--"); ++i)
if (sep = arg.find("=")) opts[arg[..sep]] = arg[sep+1..]; else opts[arg] = "x";
It might be too much for one line, but it doesn't seem to be super complicated either. In fact that line is (as of now, commit 0006330) only the second longest in that file.Sure, if you're coming from structured Pascal 101, that might be an issue, but in the day where deeply nested functional rat kings tend to replace the humble WHILE loop, is a Schwartzian transform that confusing?
In my mind, it's down to it having been popular, attracting many amateurs. You'll find equally unmaintainable bash or PowerShell scripts and definitely as much garbage, WORN JavaScript code. Writing maintainable code requires both knowledge and effort.
[0]: https://metacpan.org/pod/Modern::Perl
[1]: https://metacpan.org/pod/Moo
[2]: https://metacpan.org/pod/Mouse
I guess if you do deliberate golfing/obfuscation you can make anything unreadable.
#Before enlightenment,
use strict;
use warnings;
#After enlightenment,
use strict;
use warnings;Interestingly, I didn't know you could do this without an `eval`:
declare something${something_else}=whatever function bocker_help() { #HELP Display this message:\nBOCKER help
sed -n "s/^.*#HELP\\s//p;" < "$1" | sed "s/\\\\n/\n\t/g;s/$/\n/;s!BOCKER!${1/!/\\!}!g"
} target1: ## Do this
target2:
target3: target2 ## Do that
would be nicely formatted as the output of `make help` into Available targets:
target1 Do this
target2 Do that
and if you want to see all targets along with their origin file, even those without help messages, type `make help-all` to render Available targets:
target1 path/to/Makefile Do this
target2 path/to/Makefile
target3 path/to/Makefile Do thatThat certainly counts as reflection in the context of shell scripting... :-P
Can we really say it’s a reimplementation of Docker in 100 lines, though, when it requires other dependencies that probably total in the hundreds of thousands of lines? That’s still code that has to be audited by people so inclined. Not to mention the other setup specified in the readme and maybe having to build one of the dependencies from source. Usage doesn’t sound necessarily trivial.
Makes me appreciate Docker that much more though. Getting up to speed using it at my job and it certainly abstracts away many things, simplifying our workflow and conceptual models.
You know the comment from a guy who thought Dropbox could be easily replaced with a few Unix tools? https://news.ycombinator.com/item?id=9224
There's a difference between fulfilling a use-case well and having a technically minimal solution.
I actually wrote the core of an ansible class tool in 200 lines of Perl 20 years ago. Perhaps I should have been bought by red hat by now :)
Its almost like several of these projects existed for long until people came around took them a little more seriously and built businesses around them.
This also reminds me using the Unix DBM's do all kinds of key-value store work. Long before things like Redis and Memcached were around.
Yes, and that's a big problem.
Nowadays huge numbers of developers pick choose technologies because they are hyped up (aka marketed) rather than being wary of them.
http://eliot-jones.com:5690/Home/Trend?id=rkt&allwords=true
http://eliot-jones.com:5690/Home/Trend?id=docker&allwords=tr...
I mean heck, here we are 137 comments into a thread about an alternative to docker and I was the first to mention rkt.
Plus I think by providing infrastructure services and technology, they get valued much higher because other tech companies are their customer and they're usually rich as well
Perhaps not 'unicorn' valuable anymore as it went through that phase of adding enterprise shovel features. These days all cloud enterprise software companies must badly incorporate the features of other products because most Enterprise software buying criteria are just boxes to be ticked.
More seriously - it’s not a complete docket of course, but lines of code in a project are a liability, not an asset. If you can reduce your project size with reasonable dependencies, you should.
Certainly makes the technology interesting to investigate if it could be a fit for you as well.
It's being a toolset to build and deploy containerized applications.
In other words, being able to docker-compose up --build on any Linux, Windows and MacOS box is what's useful.
>The problem of waiting for a database (for example) to be ready is really just a subset of a much larger problem of distributed systems. In production, your database could become unavailable or move hosts at any time. Your application needs to be resilient to these types of failures.
absolute bullshit. docker compose thinks that it can excuse its bugs by dint of the fact that we're supposed to build "more resilient" applications to accommodate them.
and, their proposed workaround with "wait for" is disgusting. their tool should be able to handle readiness detection. it's so fucking basic.
it's not only this but this is an example of the bullshit in this shitty tool excused with shitty reasons.
https://blog.alexellis.io/building-containers-without-docker...
It does seem like Docker will be holding back containers from achieving their true promise, as it flounders looking for profitability and chasing k8s. Its sad that we're still moving around tar balls without advancing some of the tooling around it.
One of my biggest gripes as a non-k8s container user are that we are still keeping all this versioned cruft with every container. I would like to see an easier way to just get the latest binaries not dozens of tar hashes with versions going back to the first iteration of the container. Probably closer to singularity https://singularity.lbl.gov/
Another area is the ability to update containers in place. Hass.io https://www.home-assistant.io/hassio/ does some of this with the ability to manage the container version from within the container, but seems like a little bit of a hack from what I've seen. Watchtower is closer to what I'd like https://github.com/containrrr/watchtower, but why can't we have a more integrated system built into the default tooling?
Docker is a good tool and deserves some resources to continue developing the product and funding marketing team. I wish docker hub to be more competitive among other rivals.
I didn't say it wasn't. Docker makes sense because everyone uses it.
However, I would prefer a Docker alternative that is purely local and doesn't require so many permissions.
For me, the hardest thing about Docker was running my own registries. Or rather, configuring credentials so Docker would use them. Not to mention the hassle of doing that through Tor.
So maybe Bocker isn't so picky about registries.
"Bob¹*, unless we've solely staffed the organization with folks from coder camps a lot of the folks here should be able to carve out a couple of namespaces in the kernel. That's not interesting and that's not why we asked CoreOS to come in today. Let's talk about the actual problems they're trying to solve."
<3 <3 <3 <3
That being said, it's great that folks continue to dig in to decompose the tooling and show what's actually happening behind the scenes.
¹Bob was definitely not that guy's name.
EDIT: Added note of context appreciating the work by the author.
Once you have that then you want to deploy it in whatever way you like it. Nixpkgs has functions to for example generate a docker image that contains only your app + essential dependencies. You could deploy it using nix package manager as you would install a typical app in the OS. You could also describe configuration of NixOS that has your application included and it could generate an image of it.
Community also came up with other generators [1].
The advantage of Docker is that you can verify the container works locally as part of the build process rather than finding out it is broken due to some missing dep after a deployment. If you can verify that the image works then the mechanism for fetching the deps can be as scrappy as you like. Docker moves the dependency challenge from deployment-time to build-time.
I ask because I read your comment as saying “the advantage of Docker is that it uses (explanation of what containers are)” and the parent comment as saying “all I want from Docker is (explanation of what containers are)” and I am confused why (a) y’all are not just saying “containers” but rather “the part of docker that packages up my network of scripts so I can think about it like a statically linked binary” and (b) why you think this is a competitive advantage over other things you might have instead recommended here (Buildah, Makisu, BuildKit, img, Bazel, FTL, Ansible Container, Metaparticle... I am sure there are at least a dozen) to satisfy the parent comment’s needs.
Is there really any container ecosystem which has write-an-image-but-you-can’t-run-it-locally semantics? How do you finally run that image?
Again, Bazel is basically this already. But it would be nice to have something like OP's tool to integrate in other build systems.
I could just make a Dockerfile and say that's my build system. But then I'm stuck with Docker. The only way to run my program would be through Docker. Docker doesn't have a monopoly on the idea of a fully-realized chroot.
My build server is x64, but target output is ARM. Can't exactly just run that locally super easily. Perhaps somebody has created a container runtime that will detect this, and automatically spin up a qemu container, running an arm host image, and communicate my container run request (and image) to that emulated system, but I haven't heard of that feature. (Not that I actually looked for it.)
https://www.mgasch.com/post/scratch/
Typically a minimal Alpine distro image will allow you to pull in deps however you want (either via package manager, manual download, or copy), run a build, and then copy only the artifact over to a scratch image for a final image that's only a few MB in size.
https://medium.com/@chemidy/create-the-smallest-and-secured-...
I wonder.... is there a service (Maybe a chrome extension) that lets you ask questions on the page you are in? For example, I want to highlight:
`btrfs-progs` and ask... "What is a quick summary about this package?
`ship a new enough version of util-linux` and ask.... "What features in the new util-linux allows this to work?"
Then maybe someone who also visits this page with more knowledge can answer my questions.
This tool would augment my learning 10x and I would be a paying customer. Does something like this exist?
As an example, WikiWikiWeb (http://wiki.c2.com/) has integration with it. I've never used it, but it seems quite powerful.
Just chroot the damn thing if you need to and keep it simple.