-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker+Wasm Integration #426
Comments
I probably do not understand this very well. But I will still ask. In the browser, we use How does this work in Docker+WASM with the WasmEdge runtime. Do I have to write a WasmEdge plugin to be able to create this link to the outside world? Is this technically a part of the so-called containerd shim provided by WasmEdge? What kind of functionality is provided by the WasmEdge runtime? I looked at the API documentation but there was nothing there that resembled, for example, networking functionality or anything of this sort. I would like to understand this stuff more and how to make the most out of it. Thanks! |
Hi @diraneyya! Glad you asked! WasmEdge implements the WASI standard that gives you access to the outside world. There is still active work happening on this specification. You can follow Wasm spec work more broadly as it happens under the Bytecode Alliance. @juntao and his team can give you more information about the WasmEdge runtime specifically. |
Thanks @chris-crone and hi @diraneyya ! Yes, WASI specifies how WebAssembly Runtimes, including WasmEdge, access the operating system. That includes standard POSIX / libc APIs to access the file system / network etc. So, you can just create a Rust program to open a file or open a socket connection or write to the console (eg print!() and dbg!() macros), compile it to wasm32/wasi target, and it will run in WasmEdge. See https://wasmedge.org/book/en/write_wasm/rust.html You can also do this with other languages supported in WasmEdge including JavaScript. |
Hey folks - Heads up that I'm not able to get the tech preview to run on an intel Mac. I am a Docker Desktop user and the stable version works fine. Let me know if you would like any debug information to assist. I'm really excited to see this and would love to try it out |
Hi @lachie83! Sorry to hear it isn't working. We'll reach out via email to get more details |
Thanks Chris - happy to help. |
@lachie83, @chris-crone, FWIW - I was able to run it on first shot. Here are some details about my setup in case they help debug:
|
Looks like similar hardware and Kernal, different OS
|
Well done @mikesir87 and team, this is very exciting work. I'm looking forward to seeing this work as a driver for WASM through the ecosystem, e.g., resolving/landing opencontainers/image-spec#964, and seeing https://wasmedge.org/book/en/use_cases/kubernetes/docker/containerd.html filled out. I for one welcome our new micro-microservice overlords. I wasn't mentioned in the blog post, but where is So I'm assuming it's not public yet, but will be? |
Can someone confirm this is the same containerd shim used under https://learn.microsoft.com/en-us/azure/aks/use-wasi-node-pools right? Just want to make sure when developing a generic WASI app it runs in Docker WASM. |
Hi @TBBle Thank you for your kind words. Please do let us know if you encounter any issues. We cannot wait to see the Wasm microservices you create. :) The containerd shim for WasmEdge is here: https://github.com/second-state/runwasi We are in the process of merging it upstream to DeisLabs runwasi project, and hopefully eventually to the containerd project itself. |
It is not the same. But all standard compliant WASI app should work in both environments. If not, let us know. :)
|
Just chiming in quickly to confirm what @juntao says here. The wasmedge team did in fact use the core https://github.com/deislabs/runwasi shim to quickly provide wasi support in containerd with the wasmedge runtime and we're thrilled it worked perfectly for the Docker Desktop preview. As a result, @tigerinus, our path for bringing the two together and moving the shim upstream to the containerd project is pretty easy and we look forward to working on that together. In fact, the community's collective work on https://github.com/deislabs/runwasi -- including enabling any number of open source runtimes like SecondState's wasmedge -- will continue rapidly. If you're interested, you can track that repo (which we hope to move into the containerd repo as soon as we can). Using the Docker Desktop+wasm preview with the https://github.com/second-state/runwasi will not be any problem for using future shims. It's a great way to get started here! |
Great work everyone and very exciting! I'd be keen to see the following from Docker Desktop going forward:
|
Anything else, @nigelpoulton ? I mean, make it at least HARD. |
Mind you, on 1 I am of course speaking for myself here, not Docker. :-) |
Quick question: can we leverage HPA to autoscale WASM module like traditonal PoD? |
you will be able to use all the normal k8s mechanisms with either version of https://github.com/deislabs/runwasi as we roll forward. At the moment, however, telemetry isn't working well -- we have to emit things to enable this. We should soon have a new version of the runwasi shim (and secondstatewill work on theirs until we coalesce) that will emit all the telemetry needed for any k8s scaling scenario. The ONLY thing that will not yet work is mixed containers/wasm inside one pod. This precludes the usage of service messes in k8s for the time being. Nailing that scenario is in the backlog but we have no roadmap timing for that yet. Ironically, as service messes have lots of headspace we have very little evidence that lots of people use them: https://www.datadoghq.com/container-report/ says only about 10% of people use meshes..... ymmv. |
Although full-on service meshes might not have high penetration, I note that mixed containers/wasm is also an important use case to implement sidecars for telemetry collection, e.g. Datadog Agent, OTel Agent, Jaeger Agent. I don't know in general how the split is between (possibly auto-injected) sidecar agents and host agents (e.g., HostPort-based Daemonsets), but Datadog specifically excluded their own Agent sidecar from that report, so presumably it's widespread enough that it matters in such data. (Since they use data from their Agent for the report, presumably it'd have been present on 100% of hosts in their report if they didn't exclude it, but it would have been interesting to see the split between deployment style.) I'll note that anecdotally the last two k8s-based applications I was involved in building both relied on auto-injected telemetry sidecars (once with Jaeger Operator, once with OTel Operator), but since I was the common factor there, that's pretty low-quality signal even for anecdotal data. |
Thx @squillace for your reply. Before, we played around with deislabs/krustlet . With Krustlet, we are able to deploy WASM module into K8s cluster. But, we are NOT able to eanble HPA feature (for autoscaling). Two questions:
|
in reverse order:
Turns out that ContainerD shims are right abstraction for that. Krustlet might still become very useful for key situations. Are you using Krustlet successfully aside from the autoscaling? |
Oh yes -- because that's how they work now. With Wasm components, you'd be moving toward an in-proc OTEL component that exports such information. Sidecars are horrible unless you have only one or two -- not because the model doesn't work, but because it's just harder to use. BUT we use them!!!! For example, we've test implemented Dapr sidecars as components and WOW does that change things. It's almost as if kubernetes is good. :-P That said....
I'm expecting that we'll make this happen. But it's not going to happen this month. First, we make these solid, enable componentized runtimes so that people can choose theirs to use, and upstream the shim work to the ContainerD project in the CNCF. |
Other features works well. BTW, I recalled there is open issue mentioning this limitation too: krustlet/krustlet#470 |
Hey guys, great work! Have one question - how do I pass arguments to the underlying runtime? In my case I want to access files on my local machine. Now, if I do this with wasmedge separately I'd just have to add a say I tried mounting with -v when I run the "wasm container" but that was not enough. E.g. using singlestore-labs' python I could do something like this
The key thing here is So I built myself an image that has just python3.11.wasm and python311.zip but couldn't make it work. Even running the interpreter fails as it does not pick the env variables. Tried passing them to the container, as usual, but that did not propagate them to the wasm module.
Any help or ideas would be greatly appreciated. |
Hi @assambar The Wasm file is packaged in a SCRATCH OCI image. It has access to the / directory of the container. So you can mount a directory to the container and then access it from inside the Wasm app. Let us know if it works. Thanks! |
Hi @squillace & Community Members, Beside Autoscaling, are there any other known limitations? We can't wait to roll out this features to our Production env :) Suppose we have K8s as our Application Hosting Platform, to enable user/developer to be able to deploy to WASM-based Application (i.e. WASM Module) to our K8s env, is there any special settings/configuraiotns required for my K8s cluster? OR all I have to do is to package WASM file/module in a docker image (i..e. SCRATCH OCI Image)? Another question: Once the Docker image (containing WASM file) is deployed to K8s, it's running in a Container like other tradiiotnal non-wasm Docker image? from user's perspective, it's totally transparent? Thanks in adavnce. |
Per https://docs.docker.com/desktop/wasm/ I believe it's now part of the main Docker Desktop distribution as a Beta feature. However, as Docker limits who has access to Beta features, it may not be accessible to you. (I recently noticed I couldn't access the Containerd Image Store feature toggle which this one depends on anymore, when I went to test a related fix in buildx). |
Hey all, thanks for the ping, it's an error on our side, I'm fixing it right now, will give an update quickly.
@TBBle the containerd image store feature is accessible to everyone, the feature is not accessible if you are using windows containers on windows, was that the case maybe? |
Oh, duh. Yeah, that's my mistake. Sorry for the confusion. Edit: On reflection, I spent enough time looking at both the containerd side of the Image Store and Windows Docker/containerd integration work that this requirement should have been obvious to me, but I forgot, and I notice that the docs don't actually mention this requirement. I haven't noticed anyone else getting caught with this mistake though. Some day we'll have a feature toggle for "WCOW Containerd integration" and I hope that will include Containerd Image Store automatically. |
When using latest (4.20.1) Docker Desktop, building image with It's annoying as this fails the build script we have, but this does not happen in the first Docker Desktop version (4.15.0) where wasm support was provided. |
I believe opencontainers/image-spec#1055 is probably relevant ( |
@suneetnangia , thank you for the report. |
Thanks @jprendes It worked for me. |
I've been doing a bit of reading lately about the built-in wasm runtime. their documentation is written very messy, and senior developers understand that the documentation is divided into two categories, the first for the use of tutorials document, the second is the API documentation. And their software promotion and traditional rogue virus software,installed in the case of the user without knowledge of your computer, without the user's permission, similar to the early PC software bundled sales, which is a disgusting behavior, bundled in the docker sales. |
Are there docs covering how to run wasm docker apps without requiring Docker Desktop? All the docs at https://docs.docker.com/desktop/wasm seem to assume/require Docker Desktop specifically. I'm working on adding support for building wasm containers using |
HI @imjasonh |
It would be really useful if we could save the wasm file from the image. Currently, it possibly to save the entire OCI image. |
@cataggar The easiest method I can see is something like:
The limitation is that images are stored as tar-streams, so to do what you want, they'd basically have to implement If this was from a running or stopped container rather than an image, That said, this isn't Wasm integration specific, so I'd suggest opening a feature request if you want to actually pursue such a feature in Docker. |
I hope the Docker Engine supports wasm, not just Docker Desktop |
@Avey777 it does. |
Any work/timeline on having this as part of Docker Engine and not just Docker Desktop? I am trying to figure out how to run this on the cloud, more specifically on GCloud Run where I don't have access to docker daemon. So can't use @jprendes's suggestion. |
That link is the instructions for using this with Docker Engine directly, i.e. if you aren't using Docker Desktop. If you're using Docker Engine managed by someone else, you'll need to raise a feature request with them to offer WASM support. Right now, from their docs, Google Cloud Run only supports Linux x86_64 ABI executables. Looking around, I'm not convinced Google Cloud Run even uses Docker Engine; from the docs, it is running either in gVisor, or as containers inside some sort of hypervisor. But either way, this is not something Docker has any say in, you'll have to request it from Google directly. https://issuetracker.google.com/issues/271552514?pli=1 might cover it already, actually. So I'd suggest upvoting that issue, and maybe note that you expect to see something compatible with existing |
I am not sure if this is the right place to mention this, but I seem to have hit a problem with the tutorial at: When I run the following, I simply get
To note:
|
That looks like a documentation issue, your outcome looks correct for that project's documentation. Try Either way, your setup is working, as you were able to run the WASM-based container. This difference should not prevent you continuing to explore the Docker WASM integration beta. |
@TBBle Thank you for the response! I attempted to run this:
When I did, I got this response: But when I visit |
@johnstonphilip as with any image, you need to expose the port
then you can do
|
I am not able to get correct docker stats for wasm container, its always near to 0%. Also I am not able to
I am trying to compare CPU usage of wasmedge-quickjs with nodejs. Kindly suggest. |
@ankianan - you cannot exec into a WebAssembly and run e.g. I'm not sure what types of metrics WasmEdge may serve through containerd, but you could ask that question here: https://github.com/containerd/runwasi |
You're trying to execute a program called I expect you can use
|
I'm going to close this issue in favour of moving the conversation around Wasm support over to https://github.com/moby/moby so we can handle incoming feedback and requests in individual issues! If you have any issues or suggestions around support, please feel free to open an issue over there. We'd love to hear from you! |
Tell us about your request
As a developer, I would like to have the ability to build, share, and run Wasm applications using Docker Desktop.
Which service(s) is this request for?
Docker Desktop
Additional context
This post is intended to gather feedback on the new Docker+Wasm integration. Feel free to share issues or ideas on how we can make the product better!
The text was updated successfully, but these errors were encountered: