NilsIRL
Joined 7 years ago
Joined 7 years ago
Very curious about this. As do many people I struggle to finish projects.
How does one learn this skill?
As for WASM, this is already possible using container2wasm[0] and wasmer[1]'s ability to generate static binaries.
[0]: https://github.com/ktock/container2wasm
[1]: https://wasmer.io/
An alternative is to extract the image to disk but that has quite a bit of overhead.
dockerc allows you to re-use your existing docker images without having to spend time packaging something up.
The applications running from dockerc-generated executables run inside a container so they are guaranteed to be hermetic.
> What about using Zon for deps, instead of a git submodule?
I couldn't find documentation quickly enough (dockerc was initially during a hackathon and was my first time using Zig). I plan to fix this eventually.
Even if you path through `/dev/fuse` and `/usr/bin/fusermount3` (using -v) it fails the mount the fuse filesystems with the error message "Operation not permitted".
It might be possible to make it work if it falls back to extracting the container when failing the mount the fuse filesystems.
That's not an issue because the mounts are within the Linux VM. At least as long as you're not trying to implement volumes.
> I understand this is not something that's implemented yet, but I'm wondering about your goals.
Make a better alternative for all the projects that suggest using `docker run` in their READMEs. Something that's easy to setup (re-use existing Dockerfiles) and something that doesn't depend on pre-existing setup from the user (which docker does).
> The much larger hurdle I see for Windows support is that I don't think you can setup virtualization without Admin privileges in the general case. If Hyper-V is not already present and enabled you'll need to install some hypervisor. Even QEMU needs Hyper-V for proper virtualization.
That's good to know. I didn't know that. I guess it will need to use emulation in some cases then.
There's a few things that seem to make it unsuitable for the intended use case of dockerc:
* The container extracts itself which means there is quite a bit of overhead for large images. dockerc-built executables have the same startup time whether the image is 2.2GB or 25MB.
* The executables produced by enroot don't seem suitable for running standalone. At least the example doesn't seem to suggest so.
The use case is for distributing software to end users.
However having written it in Zig I have a few retroactive reasons for why Zig was a good choice (if not the best choice):
* The build system allows to make the runtime a dependency of the "compiler". I don't think any other language has that.
* The interoperability with C/systems calls is amazing (in comparison to anything but C/C++)
* The ability to embed files
* Makes it incredibly easy to make static binaries
[1]: https://github.com/NilsIrl/dockerc/blob/68b0e6dc40e76c77ad0c...
[email protected]
@NilsIRL everywhere
<script>alert(1);</script>