support webAssembly
What is the problem you're trying to solve
now docker already support webAssembly refer:https://docs.docker.com/desktop/wasm/
Describe the solution you'd like
support webAssembly like docker
Additional context
No response
What change is needed?
Hi, nerdctl team. I'm newer to nerdctl. But let me share my knowledge. runc and youki already support running wasm. https://containers.github.io/youki/user/webassembly.html
I wonder if it would be feasible to change the oci runtime via nerdctl and annotate the config.json? If we can do that, we can support them. As the youki team, please let us know if there is anything we can do to help.
nerdctl run --label is propagated to OCI runtime annotations, so it should just work?
I guess containerd-shim-wasmtime-v1 should also work?
https://github.com/deislabs/runwasi
Is there any change needed on the nerdctl side?
nerdctl run --labelis propagated to OCI runtime annotations, so it should just work?
Awesome. Maybe this will work if it propagates to the OCI Runtime side that supports it.
I guess containerd-shim-wasmtime-v1 should also work? https://github.com/deislabs/runwasi
I guess yes :+1:
Is there any change needed on the nerdctl side?
Perhaps from the user's side, if they pass the flag(e.g. nerdctl run --wasm ...), they can run it in wasm, or they want a frendly document for wasm?
extract from docker
--platform=wasi/wasm32. This specifies the architecture of the image you want to use. By leveraging a Wasm architecture, you don’t need to build separate images for the different machine architectures. The Wasm runtime does the final step of converting the Wasm binary to machine instructions.
So we should also support the platform wasi/wasm32 not sure that we support this on the nerdctl side
extract from docker
--platform=wasi/wasm32. This specifies the architecture of the image you want to use. By leveraging a Wasm architecture, you don’t need to build separate images for the different machine architectures. The Wasm runtime does the final step of converting the Wasm binary to machine instructions.So we should also support the platform
wasi/wasm32not sure that we support this on the nerdctl side
ctr do not require the to set the platform https://github.com/deislabs/runwasi#containerd-shim-wasmtime-v1
When I using the runwasi, the ctr can run successfully:
root@kay201:~# sudo ctr run --rm --runtime=io.containerd.wasmedge.v1 ghcr.io/containerd/runwasi/wasi-demo-app:latest testwasm2 /wasi-demo-app.wasm echo 'hello'
exiting
hello
But it can not used by the nerdctl:
nerdctl -n default run --rm --runtime=io.containerd.wasmedge.v1 ghcr.io/containerd/runwasi/wasi-demo-app:latest echo 'hello'
Output:
WARN[0000] cannot set cgroup manager to "systemd" for runtime "io.containerd.wasmedge.v1"
FATA[0000] failed to create shim task: Others("hook command exited with non-zero exit code: 1"): unknown
I think there may be some issue with the hooks :-)
I think there may be some issue with the hooks :-)
Could you open an issue in the runwasi repo?
I think there may be some issue with the hooks :-)
Could you open an issue in the runwasi repo?
I'm still invesgating the cause of issue , and not sure its runwast's issue :-)
When I using the runwasi, the
ctrcan run successfully:root@kay201:~# sudo ctr run --rm --runtime=io.containerd.wasmedge.v1 ghcr.io/containerd/runwasi/wasi-demo-app:latest testwasm2 /wasi-demo-app.wasm echo 'hello' exiting helloBut it can not used by the nerdctl:
nerdctl -n default run --rm --runtime=io.containerd.wasmedge.v1 ghcr.io/containerd/runwasi/wasi-demo-app:latest echo 'hello'Output:
WARN[0000] cannot set cgroup manager to "systemd" for runtime "io.containerd.wasmedge.v1" FATA[0000] failed to create shim task: Others("hook command exited with non-zero exit code: 1"): unknownI think there may be some issue with the hooks :-)
I met the question toooo.
Things were going well when I used ctr:
root@node-154:~/projects# ctr run --runtime io.containerd.wasmedge.v1 --platform=wasi/wasm docker.io/wasmedge/example-wasi:latest example-wasm
Random number: -1232506751
Random bytes: [200, 18, 114, 41, 83, 31, 9, 234, 134, 63, 159, 196, 193, 237, 51, 255, 34, 117, 227, 155, 24, 195, 139, 77, 169, 0, 215, 32, 134, 82, 51, 107, 123, 71, 211, 188, 86, 176, 5, 8, 100, 35, 86, 209, 52, 135, 104, 236, 231, 95, 103, 130, 157, 252, 182, 98, 180, 189, 211, 33, 79, 71, 54, 60, 184, 72, 91, 85, 44, 23, 96, 210, 217, 226, 167, 99, 155, 231, 197, 89, 23, 224, 144, 229, 229, 240, 244, 37, 55, 200, 254, 192, 188, 4, 233, 146, 39, 179, 73, 75, 166, 205, 115, 183, 17, 101, 99, 205, 135, 113, 173, 111, 77, 89, 99, 195, 164, 186, 6, 147, 238, 27, 75, 211, 121, 144, 121, 167]
Printed from wasi: This is from a main function
This is from a main function
The env vars are as follows.
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
The args are as follows.
/wasi_example_main.wasm
File content is This is in a file
But when I used nerdctl,it went wrong:
root@node-154:~/projects# nerdctl run --runtime io.containerd.wasmedge.v1 --platform=wasi/wasm docker.io/wasmedge/example-wasi:latest example-wasm
WARN[0000] Platform "wasi/wasm" seems incompatible with the host platform "linux/amd64". If you see "exec format error", see https://github.com/containerd/nerdctl/blob/main/docs/multi-platform.md error="unknown OCI architecture string: \"wasm\""
WARN[0000] cannot set cgroup manager to "systemd" for runtime "io.containerd.wasmedge.v1"
FATA[0002] failed to create shim task: Others("hook command exited with non-zero exit code: 1"): unknown