-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
WASI network access example #9849
Comments
container2wasm only supports networking through the use of a helper program c2w-net running on the host as native program: https://github.com/ktock/container2wasm/tree/main/examples/networking/wasi It looks like container2wasm targets wasip1 which only supports exposing a server over the network listening at a wasm runtime defined port (which c2w-net seems to take advantage of). You need wasip2 to be able to actually connect to arbitrary servers without a proxy like c2w-net. |
@bjorn3 thank you for your quick response!
How do I do that? I thought my code was already already targeting preview2 |
Container2wasm doesn't use wasip2. You did have to ask the maintainer of container2wasm to add wasip2 support. |
@bjorn3 so you mean my code is fine and supports preview 2, but the loaded WASM module produced by |
Indeed. container2wasm produces wasip1 rather than wasip2 wasm modules.
You need different code to load wasip1 and wasip2 modules. Your current code is correct for wasip1, but once container2wasm supports producing wasip2 modules, you will need some changes to load the wasip2 module. |
@bjorn3 are there any examples for wasip2? |
This PR updates the WASI example in this repo to wasip2. |
It looks like Wasmtime is performing as-expected here and while there's perhaps follow-up items with tools like |
Hello,
I am trying to use
container2wasm
to run a Linux VM insidewasmtime
. Here is my code:It works great and I have access to a shell/prompt. But for some reason, network requests fail:
What am I missing?
The text was updated successfully, but these errors were encountered: