docker-compose up 问题使用 Docker Apple M1

标签 docker

我真的不熟悉 docker,但我正在使用 docker 运行一个 web 应用程序,它使用了 Prisma/nexus
当我尝试组合时,出现此错误:

 Error: Unknown binaryTarget linux-arm-openssl-undefined and no custom binaries were provided

有人能告诉我这个错误是什么意思,我该如何解决?我认为这与 docker 不支持我正在开发的操作系统有关,但我不完全确定。

最佳答案

来自 the official docs ,

Prisma Client consists of three major components.

  • JavaScript client library
  • TypeScript type definitions
  • A query engine (in the form of binary file)

虽然生成的代码是跨平台的(这是 javascript),但 query engine不是。
当您运行 prisma generate 时命令,prisma 似乎使用 query engine ,但它需要为当前平台找到合适的二进制文件 otherwise it throws an error .
问题是由于某种原因我无法解释(因为我有同样的问题)docker 中的平台未被识别为 supported platform one .
我的猜测是 docker 提供了错误的平台,或者在某些时候在 Prisma 中存在错误,错误消息 linux-arm-openssl-undefined undefined其中可能是问题的线索。
解决方案:现在:我计划在 x86 计算机上运行我的图像 解决这个问题的时间。最新的 docker 3 RC2(5 天前发布)也没有帮助。
请注意,您可以在 schema.prisma 中指定 binaryTargets文件。
generator client {
  provider = "prisma-client-js"
  binaryTargets = ["debian-openssl-1.1.x"]
}
但是出于某种原因,即使我在 debian 上构建我的 docker 镜像,这也不起作用。 Prisma 似乎认出我在 linux-arm但无法将 binaryTarget 关联到。还有……这个平台真的准确吗? docker 是在后台运行 linux arm 还是在 rosetta 下运行 x86 debian?我不知道。
[编辑]
节点图像是多架构的,这意味着
FROM node:15.12.0-buster-slim AS builder
将为我的主机平台 (linux/arm64/v8) 选择 linux 架构
看来我们实际上可以build for x86 on m1 using buildx experimental feature according to this post

关于docker-compose up 问题使用 Docker Apple M1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66530969/

相关文章:

php - 无法从 php 访问 localstack s3

docker - 如何自动缩放 Docker 容器主机?

c# - 如何在docker中设置dotnet core的环境?

javascript - 如何通过 API 启动 hyper.sh 容器? (接收“执行失败 : no such file or directory error)

postgresql - 如何与普通数据库进行负载平衡

docker - 如何在Docker中分配时区

docker - 构建并发布 docker 镜像到 Nexus3

docker - iptables:无链/目标/匹配错误(使用docker网络创建)

docker - 用docker创建 Jenkins 图像

windows - Windows 上的 Docker : Error processing tar file(exit status 1): write/app/wiki. de.bin:设备上没有剩余空间