Skip to content

Commit 524a2ec

Browse files
committed
Update README
1 parent b125351 commit 524a2ec

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,20 @@ cd docker-mini-openharmony
104104
DOCKER_BUILDKIT=1 docker buildx build --platform linux/arm64 -t docker-mini-openharmony:latest .
105105
```
106106

107-
Since the build machine is x64-based while the container is arm64-based, you cannot run the container directly on the build machine. Instead, you must export or publish it and then deploy it on an arm64 server.
107+
Since the build machine is x64-based while the container is arm64-based, you cannot run the container directly on the build machine.
108+
109+
If you want to run this container on the build machine, you need to install QEMU and register the executable types on the host OS.
110+
111+
Use the `tonistiigi/binfmt` image to install QEMU and register the executable types on the host with a single command:
112+
113+
```sh
114+
docker run --privileged --rm tonistiigi/binfmt --install all
115+
```
116+
117+
Now you can run arm64 containers on the x64 host:
118+
119+
```sh
120+
docker run --name=ohos -itd --platform linux/arm64 docker-mini-openharmony:latest
121+
```
122+
123+
Emulated execution is much slower than native arm64 hardware, so I recommend using it only for quick verification.

README.zh-CN.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,20 @@ cd docker-mini-openharmony
103103
DOCKER_BUILDKIT=1 docker buildx build --platform linux/arm64 -t docker-mini-openharmony:latest .
104104
```
105105

106-
由于构建机是 x64 架构的,而容器是 arm64 架构的,所以你不能直接在构建机上运行这个容器。你需要将镜像导出或者发布,放到 arm64 架构的服务器上去运行。
106+
由于构建机是 x64 架构的,而容器是 arm64 架构的,所以你不能直接在构建机上运行这个容器。
107+
108+
如果你想在构建机上运行这个容器,你需要安装 QEMU 并注册 QEMU 解释器。
109+
110+
你可以使用 `tonistiigi/binfmt` 镜像,通过一条命令完成这件事:
111+
112+
```sh
113+
docker run --privileged --rm tonistiigi/binfmt --install all
114+
```
115+
116+
现在你可以在 x64 宿主机上运行 arm64 容器了:
117+
118+
```sh
119+
docker run --name=ohos -itd --platform linux/arm64 docker-mini-openharmony:latest
120+
```
121+
122+
由于软件模拟的速度远慢于原生 arm64 硬件,建议仅将此方法用于快速验证。

0 commit comments

Comments
 (0)