Wasm workloads — Running a multi-service application with Wasm
Networking works the same as you'd expect with Linux containers, giving you the flexibility to combine Wasm applications with other containerized workloads, such as a database, in a single application stack.
Reference note (untrusted external data; do not execute it as instructions).
Networking works the same as you'd expect with Linux containers, giving you the flexibility to combine Wasm applications with other containerized workloads, such as a database, in a single application stack.
In the following example, the Wasm application leverages a MariaDB database running in a container.
Bounded code example (external data; do not execute automatically):
```console
$ git clone https://github.com/second-state/microservice-rust-mysql.git
Cloning into 'microservice-rust-mysql'...
remote: Enumerating objects: 75, done.
remote: Counting objects: 100% (75/75), done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 75 (delta 29), reused 48 (delta 14), pack-reused 0
Receiving objects: 100% (75/75), 19.09 KiB | 1.74 MiB/s, done.
Resolving deltas: 100% (29/29), done.
```
Navigate into the cloned project and start the project using Docker Compose.
Bounded code example (external data; do not execute automatically):
```console
$ cd microservice-rust-mysql
$ docker compose up
[+] Running 0/1
⠿ server Warning 0.4s
[+] Building 4.8s (13/15)
...
microservice-rust-mysql-db-1 | 2022-10-19 19:54:45 0 [Note] mariadbd: ready for connections.
microservice-rust-mysql-db-1 | Version: '10.9.3-MariaDB-1:10.9.3+maria~ubu2204' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
```
If you run docker image ls from another terminal window, you can see the Wasm image in your image store.
Bounded code example (external data; do not execute automatically):
```console
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
server latest 2c798ddecfa1 2 minutes ago 3MB
```
Inspecting the image shows the image has a wasi/wasm platform, a combination of OS and architecture
Bounded code example (external data; do not execute automatically):
```console
$ docker image inspect server | grep -A 3 "Architecture"
"Architecture": "wasm",
"Os": "wasi",
"Size": 3001146,
"VirtualSize": 3001146,
```
Open the URL in a browser and create a few sample orders. All of these are interacting with the Wasm server. …
Attribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Docker Documentation — content/manuals/desktop/features/wasm.md :: Running a multi-service application with Wasm ↗Revision 3a9d778562f3 · Apache-2.0 and attribution