15 ms·
Container2wasm: Convert Containers to WASM Blobs
- ronsor 3y agoThis is quite cool... But at the same time, please tell me this is not the future of software packaging.
- withinboredom 3y agoAllow me to introduce you to https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript https://www.destroyallsoftware.com/talks/the-birth-and-death... Everything is on track.
- cryptonector 3y agoI love all of Gary Bernhardt's talks.
- actionfromafar 3y agoNewt: My mommy always said there were no monsters, no real ones, but there are. Ripley: Yes, there are, aren't there? Newt: Why do they tell little kids that? Ripley: Most of the time it's true. --- But yes, I do believe this has a strong, serverless future.
- ronsor 3y agoDownloading a 50MB WASM blob to run an emulator to boot a Linux kernel and then start an HTTP server to handle a single request is utter madness, which is probably why this will become popular to do.
- flir 3y agoI can see my house from up here!
- harrychin2 3y agohttps://www.youtube.com/watch?v=G7AinOjDiNQ https://www.youtube.com/watch?v=G7AinOjDiNQ
- peterleiser 3y agoThis will probably be a minor component of the Qeng Ho's timekeeping system: https://en.m.wikipedia.org/wiki/A_Deepness_in_the_Sky#Interstellar_culture https://en.m.wikipedia.org/wiki/A_Deepness_in_the_Sky#Inters...
- bnchrch 3y agoIf this is a step on the road to wasm being the primary target for packaging applications (without a docker image + x86 emulator intermediary)... Then I am all for it.
- mteam88 3y agoWould recommend checking out the container examples, they are suprisingly fast. https://ktock.github.io/container2wasm-demo/ https://ktock.github.io/container2wasm-demo/
- dave1010uk 3y agoAny performance benchmarks or details of the practicality? Eg could this run on something like Cloudflare Workers?
- johncolanduoni 3y agoWow, haven’t seen Bochs mentioned since I was doing hobby OS development 15 years ago. I guess there’s not a ton of emulators that don’t use JIT or hardware extensions these days.
- ex3ndr 3y agoSame here! One of my very first apps for android 1.1 was a port of bochs =)
- loxias 3y agoWhyyyyyyy. bangs head into desk
- txdv 3y agoMaybe these containers should be build for wasm-wasi instead of x86 from the beginning? Then there would be no need to emulate x86 in wasm
- jedisct1 3y agoBecause "wasm-wasi" is not a CPU that Linux runs on.
- traverseda 3y agoBut, if docker is running on WASM-WASI like it is here, maybe it's possible to do a full build toolchain as well?
- jedisct1 3y agoDocker is not running on wasm. There's a wasm app, that is a x86_64 CPU emulator, used to run a Linux VM, on top of which anything can run. Including existing Docker images for x86_64.
- traverseda 3y agoSure, fine, if an largely-compliant OCI runtime is running in a wasm-wasi context, then I see no reason you couldn't stub out syscalls to reduce dependence on linux-kernel syscalls, and gradually replace the kernel with a minimal set of stub syscalls that make sense, sort of like how gvisor has implemented 200+ linux syscalls in GO and presents an alternative OCI runtime for docker containers. Gradually reduce dependence on an emulated linux-kernel in favour of an alternative lightweight POSIX implementation that runs in pure WASM. This is something that is already done with other OCI runtimes like sysbox and gvisor.
- charcircuit 3y agoWhy is that relevant? txdv was suggesting to ditch Linux, so what CPUs Linux supports is not relevant.
- momojo 3y agoIs this a "why not" project, or are there real-world use cases for this?
- simonw 3y agoBeing able to run ANY Docker container directly in the browser is incredibly useful. The most obvious application is educational environments - this makes it trivial to provide all sorts of software for students to tinker with without needing to run any server-side code anywhere, just some static file hosting.
- Havoc 3y agoI very much doubt it's "any" docker image. WASM isn't 1:1 feature equivalent with docker. e.g. filesystem access
- simonw 3y agoIt looks to me like they solve that by simulating the entire Linux operating system, filesystem included. You won't get persistence when you restart the process, but you'll still be able to run code that needs to read and write files. Try it for yourself: visit https://ktock.github.io/container2wasm-demo/amd64-debian-wasi.html https://ktock.github.io/container2wasm-demo/amd64-debian-was... to start a shell against a Debian container, then use "echo 'hi' > hello.txt" to write a file and "cat hello.txt" to read it.
- chmod775 3y ago> You won't get persistence when you restart the process, but you'll still be able to run code that needs to read and write files. Since it's Linux and you can give it "network access" (using workarounds such as redirecting via a server), you can just use one of the existing ways to mount a remote filesystem that could be stored on the server (such as NFS, sshfs, ...). Or bridge/mount to the local browser and store it in indexeddb or whatever. It already has directory mapping when running outside a browser - maybe there's even an easy way to do this more directly than funneling everything through the virtual network.
- rehitman 3y agoIf this performs, and it is a big if, it can make life a lot easier for people with stateful services. You just push the service back to the browers and you are done. It can be a lot cheaper and lot faster, and also reduce complexity of making a stateful service scalable and reliable.
- londons_explore 3y agoAnd all the users have to download a 200MB web page every time they use your service...
- peterleiser 3y agoCan the download be cached in the browser so that subsequent web page visits don't download the same initial 200MB blob? That's better at least.
- ble 3y agothe most amazing, most wirth's law project
- Y_Y 3y agoFROM riscv64/alpine:20230208 RUN apt-get update && apt-get install -y curl The demo really is Debian, but it seems like the docs are confused about which images use Alpine instead.
- apignotti 3y agoShameless self-promotion: https://webvm.io https://webvm.io Powered by a x86->Wasm JIT. Technical writeup: https://labs.leaningtech.com/blog/webvm-server-less-x86-virtual-machines-in-the-browser https://labs.leaningtech.com/blog/webvm-server-less-x86-virt...
- cryptonector 3y agoVery nice! Most language playground sites should adopt this approach.
- JaDogg 3y agoYup. this is what I use for Yaksha playground (I use v86 though). See -- https://yaksha.pages.dev/ https://yaksha.pages.dev/
- kelvie 3y agoIt's a bit hard to tell, but this isn't open source (well, assuming we all don't consider wasm source :)), right? I got as far as "powered by cheerpx", which leads me here: https://leaningtech.com/webvm/ https://leaningtech.com/webvm/ And I'm also guessing that you guys just allow free use of the compiled wasm for demos such as this?
- nanaian 3y agoYep! CheerpX's documentation is available here: https://labs.leaningtech.com/cheerpx https://labs.leaningtech.com/cheerpx
- artificialzebra 3y agoSimilar project, but open-source: https://github.com/copy/v86 https://github.com/copy/v86
- jpeeler 3y agoDo any GUI frameworks support WASM? I've been looking for a way to run GUI applications remotely for a while, specifically on a wlroots compositor. Projects like this (maybe one day) and https://github.com/udevbe/greenfield https://github.com/udevbe/greenfield are interesting since they essentially make access universally accessible.
- echelon 3y agoI don't know about GTK, QT, and the like, but there's a whole budding ecosystem purporting to solve it WASM-native. Dioxus [1] and about a dozen other libraries are attempting to be write-once, deploy web, mobile, desktop with native performance. They adopt a React-like component UI. The Rust ecosystem is full of stuff. There are lots of different approaches too - immediate mode drawing, canvas drawing [2], etc. Choosing a winner is the hard part. There are too many projects and no clear community-elected leader. [1] https://dioxuslabs.com/learn/0.4/getting_started/wasm https://dioxuslabs.com/learn/0.4/getting_started/wasm [2] https://www.egui.rs/#demo https://www.egui.rs/#demo
- jeroenhd 3y agoGTK+ has Broadway to render GTK applications to the web browser. Qt has some ActiveX support, but you don't want that. Java/Kotlin has a bunch of frameworks, like TeaVM to run .JAR files in the browser, or Vaadin to write web GUIs like you would desktop applications. I think most languages that have been around for more than five years have some kind of GUI framework that'll run in the browser. Very worst-case scenario, you could compile a Windows executable and run them in BottledWine :P
- deleted 3y ago[deleted]
- rapnie 3y agoMakepad, very ambitious (watch the vid): https://github.com/makepad/makepad https://github.com/makepad/makepad
- satvikpendem 3y ago
- westurner 3y agocontainer2wasm > Additional Resources: https://github.com/ktock/container2wasm#additional-resources https://github.com/ktock/container2wasm#additional-resources : vscode-container-wasm: https://github.com/ktock/vscode-container-wasm https://github.com/ktock/vscode-container-wasm : > VSCode extension for running containers on VSCode for the web (e.g. github.dev, [vscode.dev,]), leveraging container2wasm Chromebooks can run vscode.dev and WASM. Is this the best way to `git clone` and run `python -m this` in a Bash/ZSH shell on a Chromebook? This could be useful with jupyter-repo2docker.
- throwitaway222 3y agoSo we're now at the point where installing Kubernetes is visiting a web page... nice.
- fulafel 3y agoPreviously: https://bellard.org/jslinux/ https://bellard.org/jslinux/
- brabel 3y agoYou've got to be kidding, typing `emacs` actually opens emacs (it seems to just download it and start it up in a few seconds)! Mindblowing.
- fulafel 3y agoAlso: https://github.com/copy/v86 https://github.com/copy/v86 - more productized browser x86 runtime, used by eg https://github.com/snaplet/postgres-wasm https://github.com/snaplet/postgres-wasm
- benno128 3y agoReally impressed by the depth and breadth of this project, well done! A particularly interesting part is the socket layer inside the browser. Other people solving this problem have previously used a proxy to a server that does the real socket implementation. This means you can't have a "browser-only" solution. The author has solved this (for HTTP/S only) by proxying HTTP requests and then re-creating them as fetch requests (details here: https://github.com/ktock/container2wasm/tree/main/examples/networking/fetch https://github.com/ktock/container2wasm/tree/main/examples/n...). I'm very interested in using this approach for my own project Runno (https://runno.dev https://runno.dev).
- buildfocus 3y agoThat does have some major caveats of course: some headers will be totally ignored by the browser due to web restrictions, some will be added/overridden (e.g. user agent), and CORS will apply (which will seriously surprise most Linux tools!). Still, very neat, agreed. Almost certainly the best you can do without having some kind of backend proxy running on either the server or the user's own machine.
- jumasheff 3y agoI really liked Browser Shell [1] It has interesting solution regarding fs. [1] https://news.ycombinator.com/item?id=30199570 https://news.ycombinator.com/item?id=30199570
- sgbeal 3y agoThis is quite possible the coolest technical accomplishment i've seen in... since... well, further back then i can currently recall. On some level, even more impressive (to me) than the AI-related advances of the 2020s. Absolutely mind-blowing. Edit: i don't mind saying that such accomplishments make me feel completely inadequate as a developer.