Skip to content
This repository was archived by the owner on Jul 14, 2025. It is now read-only.

Commit 0e8eade

Browse files
authored
docs: Add document for setup Docker+Wasm on docker daemon (#93)
Signed-off-by: jiaxiao zhou <[email protected]>
1 parent 796822a commit 0e8eade

File tree

2 files changed

+83
-1
lines changed

2 files changed

+83
-1
lines changed

deployments/k3d/DockerSetup.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Setup Docker + Wasm
2+
3+
If you are using Docker Desktop for Windoes/MacOS/Linux, please refer to this [document](https://docs.docker.com/desktop/wasm/) on turning on wasm intergration in Docker Desktop. This is the easiest way to get started with wasm shims.
4+
5+
The more important part is to enable `containerd` for pulling and storing images in Docker Desktop. Refer this [document](https://docs.docker.com/desktop/containerd/#enabling-the-containerd-image-store-feature) for more details.
6+
7+
This document is primarily for those who are using Docker daemon on Linux.
8+
9+
## Install Docker 24.0.0-beta.2
10+
11+
Before you install Docker 24.0.0-beta.2, please uninstall docker tools you have installed on your machine. Please see this [document](https://docs.docker.com/engine/install/ubuntu/) for more details.
12+
13+
```shell
14+
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
15+
```
16+
17+
After you have uninstalled docker tools, please install Docker 24.0.0-beta.2.
18+
19+
```shell
20+
curl -fsSL https://get.docker.com -o get-docker.sh
21+
22+
sudo CHANNEL=test sh get-docker.sh
23+
```
24+
25+
This will install Docker 24.0.0-beta.2 on your machine.
26+
27+
To verify the installation, please run the following command.
28+
29+
```shell
30+
docker version
31+
32+
> Docker version 24.0.0-beta.2
33+
```
34+
35+
Now you have Docker 24.0.0-beta.2 installed on your machine. Next step, we will need to edit the `/etc/docker/daemon.json` file to enable `containerd` for pulling and storing images in Docker Desktop.
36+
37+
If you don't have `/etc/docker/daemon.json` file, please create one.
38+
```json
39+
{
40+
"features": {
41+
"containerd-snapshotter": true
42+
}
43+
}
44+
```
45+
46+
Otherwise, please append the above content to the file.
47+
48+
## Build wasm images
49+
50+
Now you have Docker 24.0.0-beta.2 installed on your machine, you can build wasm images using the following command.
51+
52+
```shell
53+
cd deployments/k3d
54+
docker buildx build --platform=wasi/wasm --load -t wasmtest_spin:latest ../../images/spin
55+
```
56+
57+
The `wasi/wasm` platform specifies that the image is a wasm image. The major benefit of using this platform is that you don't need to build each image for a different computer architecture.
58+
59+
The `--load` flag tells Docker to load the image into the local Docker daemon. As described in this [issue](https://github.com/deislabs/containerd-wasm-shims/issues/87), this flag actually doesn't work for wasi/wasm platform. You will need to save the image to a tar file and load it into the local Docker daemon.
60+
61+
```shell
62+
docker save wasmtest_spin:latest -o wasmtest_spin.tar
63+
```
64+
65+
### Load the image to k3d
66+
67+
Refer to this [document](https://github.com/deislabs/containerd-wasm-shims/tree/main/deployments/k3d#how-build-get-started-from-source) to create a k3d cluster.
68+
69+
Assume you have a k3d cluster named `k3d-default`, you can load the image to the cluster using the following command.
70+
71+
```shell
72+
k3d image load wasmtest_spin.tar
73+
```

deployments/k3d/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,13 @@ k3d cluster delete wasm-cluster
3535
- `make install-k3d`: will install k3d
3636
- `make up`: will build the shims and the k3d kubernetes cluster
3737
- `make test`: will make a curl call to our deployed service
38-
- `make clean`: will tear down the cluster
38+
- `make clean`: will tear down the cluster
39+
40+
## Trouble shooting
41+
42+
If `make up` fails on this step:
43+
```shell
44+
build-workload-images
45+
```
46+
47+
It might be because you have not setup Docker+Wasm integration correctly. Please refer to this document to setup Docker+Wasm integration: [Docker Setup](./Docker%20Setup.md)

0 commit comments

Comments
 (0)