---
# System prepended metadata

title: runwasi

---

# runwasi

## Action tasks 

- [x] Add 4 demo cases with containerd in [page](https://github.com/second-state/runwasi/tree/main/demo), [PR7](https://github.com/second-state/runwasi/pull/7)
    - [x] [Hyper](https://github.com/WasmEdge/wasmedge_hyper_demo)
        - [x] [hyper-client](https://github.com/WasmEdge/wasmedge_hyper_demo/tree/main/client)
        - [x] [hyper-server](https://github.com/WasmEdge/wasmedge_hyper_demo/tree/main/server)
        partial behavior as expected, has kill task not working issue
    - [x] [Reqwest](https://github.com/WasmEdge/wasmedge_reqwest_demo)
    - [x] [SQL / DB](https://github.com/WasmEdge/wasmedge-db-examples)
        - [x] [sync insert / query](https://github.com/WasmEdge/wasmedge-db-examples/tree/main/mysql)
        - [x] [async](https://github.com/WasmEdge/wasmedge-db-examples/tree/main/mysql_async)
    - [x] [Micro Service with MySQL](https://github.com/second-state/microservice-rust-mysql)
    partial behavior as expected, has kill task not working issue
> **known issue**
> DB relative demo only work with mysql service installed on host machine, but with uncertain issue when interact with mysql service run inside official docker container.
- [x] Fix cross compile image for docker desktop fail (broken because WasmEdge not as sub-tree folder inside runwasi repo anymore), [PR5](https://github.com/second-state/runwasi/pull/5)
- [x] Fix kill task still stuck in async demo, [PR9](https://github.com/second-state/runwasi/pull/9)
- [x] Fix network issue mentioned by Chris, [PR3](https://github.com/WasmEdge/wasmedge_hyper_demo/pull/3)
https://gist.github.com/chris-crone/e6644a1d094461301ba32db15f372ef9

## Setup tutorial

1. Install [docker engine](https://docs.docker.com/engine/install/ubuntu/)
    ```shell=
    sudo apt-get remove docker docker-engine docker.io containerd runc

    sudo apt-get update
    sudo apt-get install \
        ca-certificates \
        curl \
        gnupg \
        lsb-release
    sudo mkdir -p /etc/apt/keyrings
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    echo \
      "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
      $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

    sudo apt-get update
    sudo apt-get install docker-ce docker-ce-cli containerd.io
    sudo service docker start
    ```

2. Manual install docker-cli plugin ([buildx](https://docs.docker.com/build/buildx/install/), compose)
    ```shell=
    mkdir ~/.docker/cli-plugins/
    curl -SL https://github.com/docker/compose/releases/download/v2.11.2/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
    chmod +x ~/.docker/cli-plugins/docker-compose

    wget https://github.com/docker/buildx/releases/download/v0.9.1/buildx-v0.9.1.linux-amd64 -O ~/.docker/cli-plugins/docker-buildx
    chmod +x ~/.docker/cli-plugins/docker-buildx
    ```

3. Install wasmedge

    ```shell=
    $ curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash
    $ sudo -E sh -c 'echo "$HOME/.wasmedge/lib" > /etc/ld.so.conf.d/libwasmedge.conf'
    $ sudo ldconfig
    ```

4. Install wasmedge shim from runwasi repo
    ```shell=
    git clone https://github.com/second-state/runwasi.git
    cd runwasi
    make build
    sudo make install
    ```

5. Run docker (compose) or containerd with shim together
First, because the shim will be installed into `/usr/local/bin`, so make sure your env `PATH` including this. If wasmedge shim installed ready, then you can just run docker or ctr command specifies runtime to `io.containerd.wasmedge.v1`. For example

    ```shell=
    sudo ctr run --rm --net-host --runtime=io.containerd.wasmedge.v1 docker.io/library/hyper-demo:latest testserver /server.wasm
    ```
    or run `docker compose up` inside [hyper-demo](https://github.com/WasmEdge/wasmedge_hyper_demo), the docker-compose.yml is already set runtime use `io.containerd.wasmedge.v1`. The key point is symbol `io.containerd.wasmedge.v1` will be auto resolved to shim binary on the host. That why we need install shim into our `PATH` and and the binary names should be consist.
    

    
> Appendix
> I think step 1 ~ 2 could be omitted if you install [docker-desktop](https://docs.docker.com/desktop/install/ubuntu/) directly. But I have not run with this way.
> And if our runtime has been migrated to docker-desktop ready, I think step 1 ~4 could be omitte.