containerd / runwasi

Facilitates running Wasm / WASI workloads managed by containerd
Apache License 2.0
1.1k stars 95 forks source link

Use argument --tcplisten #45

Closed martinlinkhorst-urbit closed 1 year ago

martinlinkhorst-urbit commented 1 year ago

How do I pass arguments to wasmtime through the shim? I want to use --tcplisten to listen for TCP connections.

I'm trying this command.

ubuntu@wasi:~$ sudo ctr run --rm --runtime=io.containerd.wasmtime.v1 docker.io/martinlinkhorst/wasi:latest wasi10
info: Microsoft.Hosting.Lifetime
      Now listening on: http://localhost:5000
Fatal: TCP accept failed with errno 8. This may mean the host isn't listening for connections. Be sure to pass the --tcplisten parameter.
Mossaka commented 1 year ago

We currently don't have a way to pass arguments to embedding wasmtime in the shim. What you can do, however, is to write a new shim using runwasi as a library and enable tcplisten in wasmtime.

Check this out: https://github.com/Mossaka/containerd-wasm-shims/blob/main/containerd-shim-aspdotnet-v1/src/main.rs#L89-L90

martinlinkhorst-urbit commented 1 year ago

Thanks a lot!

cpuguy83 commented 1 year ago

Going to go ahead and close this as this should indeed be done in a new shim. The shims in this repository are (currently) strictly for wasi.

The wasmtime shim is also not using the wasmtime binary which is what implements this functionality. It is using wasmtime as a library.