在我的 M1 Macbook 上构建 Alpine 图像时收到错误

Receiving error on building an Alpine image on my M1 Macbook

当我在我的 Macbook M1 上构建我的 Dockerfile 镜像时,我开始收到关于 syslinux 具体的错误,如果我要评论它,我会继续收到这样的错误:

fetch http://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.13/main: UNTRUSTED signature
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.13/main: No such file or directory
fetch http://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.13/community: UNTRUSTED signature
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.13/community: No such file or directory

所以我知道问题围绕着我使用的存储库,所以这是我 ENTRYPOINT 在我的 Dockerfile 中这样说的地方:

ENTRYPOINT /src/aports/scripts/mkimage.sh \
    --tag v3.13 \
    --outdir /build \
    --arch x86_64 \
    --repository http://dl-cdn.alpinelinux.org/alpine/v3.13/main \
    --extra-repository http://dl-cdn.alpinelinux.org/alpine/v3.13/community \
    --profile iot

我相信这会在我的 M1 上工作,但事实并非如此!我使用了另一台 Macbook 并构建了它,但为什么不使用 M1?我将不胜感激任何帮助。

编辑 2:添加完整的 Dockerfile:

# This image contains the build environment for edge appliance install ISOs
FROM alpine:3.13

# Define metadata
LABEL maintainer="this_dude@dude.net"

# Configure user
RUN addgroup root this_build

# Initialize update and upgrade on Alpine AMI
RUN apk -U upgrade

# Install dependencies
RUN apk add --no-cache \
    alpine-conf \
    alpine-sdk \
    apk-tools \
    dosfstools \
    grub-efi \
    mtools \
    squashfs-tools \
    syslinux \
    xorriso

WORKDIR /src

# Clone alpine ports repository containing the iso builder
RUN git clone --depth=1 --branch v3.13.2 git://git.alpinelinux.org/aports
RUN chmod +x aports/scripts/mkimage.sh

# Include edge appliance image profile
RUN ln -sf /build/mkimg.run.sh /src/aports/scripts/mkimg.run.sh

WORKDIR /build

# Run ISO build
ENTRYPOINT /src/aports/scripts/mkimage.sh \
    --tag v3.13 \
    --outdir /build \
    --arch x86_64 \
    --repository http://dl-cdn.alpinelinux.org/alpine/v3.13/main \
    --extra-repository http://dl-cdn.alpinelinux.org/alpine/v3.13/community \
    --profile iot

如您所见https://pkgs.alpinelinux.org/packages?name=syslinux the syslinux bootloader package has not support for aarch64 (M1 processors). I would suggest to use another bootloader with AMD and ARM support - for example https://pkgs.alpinelinux.org/packages?name=u-boot&branch=edge

并且不要忘记将入口点中的 --arch x86_64 参数更改为 --arch aarch64 如果你想 运行 它在你的 M1 处理器上没有错误。或者只是删除它以使用 sh 脚本中的 default_arch