简体   繁体   English

在 ARM64 上构建 docker 映像时出错

[英]Error while building docker image on ARM64

I wrote this Dockerfile for an os我为操作系统编写了这个 Dockerfile

FROM randomdude/gcc-cross-x86_64-elf
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y nasm
RUN apt-get install -y xorriso
RUN apt-get install -y grup-pc-bin
RUN apt-get install -y grup-common
VOLUME /
WORKDIR /

and while running sudo docker build buildenv -t testos-buildenv on the terminal i got this log Sending build context to Docker daemon 2.048kB Step 1/9 : FROM randomdude/gcc-cross-x86_64-elf ---> c7e17c42eb04 Step 2/9 : RUN apt-get update ---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested ---> Running in 32e48dbf4a9c exec /bin/sh: exec format error The command '/bin/sh -c apt-get update' returned a non-zero code: 1在终端上运行 sudo docker build buildenv -t testos-buildenv 我得到了这个日志 Sending build context to Docker daemon 2.048kB Step 1/9 : FROM randomdude/gcc-cross-x86_64-elf ---> c7e17c42eb04 Step 2/ 9 : RUN apt-get update ---> [警告] 请求的图像平台 (linux/amd64) 与检测到的主机平台 (linux/arm64/v8) 不匹配,并且没有请求特定平台 ---> 在 32e48dbf4a9c 中运行exec /bin/sh: exec format error 命令“/bin/sh -c apt-get update”返回非零代码:1

this file is inside /home/user/Desktop/os-systems/test-os/buildenv这个文件在 /home/user/Desktop/os-systems/test-os/buildenv

i need help to solve it我需要帮助来解决它

Of course..It is for x86.当然......它适用于x86。

It depends on what you want to do.这取决于你想做什么。

If you want use it on your os.如果你想在你的操作系统上使用它。 You have to build an arm64 version image.您必须构建一个 arm64 版本的映像。 You have to replace some x86 dependences in the original Dockerfile and re-build it.您必须替换原始Dockerfile中的一些 x86 依赖项并重新构建它。

This Dockerfile is mentioned by the base image's description you use.您使用的基础镜像的描述提到了这个 Dockerfile。

If you want use a x86 image but just want to build it on your OS (arm64), then you could try to use buildx .如果您想使用 x86 映像但只想在您的操作系统(arm64)上构建它,那么您可以尝试使用buildx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM