I am trying to use podman to run a Wasm module as shown here, but I keep getting the error "Exec format error".
I have a Wasm module named "hellor.wasm" which executes correctly using both wasmer and wasmtime.
I am running podman on Rocky Linux 8:
podman version
Client: Podman Engine
Version: 4.2.0
API Version: 4.2.0
Go Version: go1.18.4
Built: Tue Nov 8 13:34:11 2022
OS/Arch: linux/amd64
I created this Dockerfile:
FROM scratch
COPY hellor.wasm /
CMD ["/hellor.wasm"]
I then ran buildah with this command:
buildah build --annotation="module.wasm.image/variant=compat" -t wtest5
I then tried to run the module with this podman command:
podman run wtest5:latest
exec /hellor.wasm: exec format error
I then installed the latest version of crun, replacing /usr/bin/runc with the crun binary from https://github.com/containers/crun. However, I still get the same error:
podman run wtest5:latest
# {"msg":"exec container process `/hellor.wasm`: Exec format error","level":"error","time":"2022-12-23T18:43:47.495630Z"}
Is there something else I need to do to enable podman to run Wasm?
Solved, thanks to help from the crun developers.
To build crun for wasm, it is first necessary to install wasmedge. These commands worked on Rocky Linux 8:
Next, crun has to be built using "--with-wasmedge" configure flag (note package dependencies for running on RHEL/CentOS 8):
Then crun will show that wasm support is installed:
For use by podman, replace runc with the new crun:
Then, podman can run the wasm module: