【问题标题】:Receiving error on building an Alpine image on my M1 Macbook在我的 M1 Macbook 上构建 Alpine 映像时收到错误
【发布时间】:2021-08-10 17:56:48
【问题描述】:

当我在我的 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

所以我知道问题与我使用的存储库有关,所以这就是我在 Dockerfile 中有 ENTRYPOINT 的地方:

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

【问题讨论】:

  • 请分享你的 Dockerfile 或者至少你的父镜像。我很确定这完全取决于您在不同架构上的情况。所以你需要获取arm64 而不是x86_64
  • 好的,让我补充一下。

标签: docker alpine apple-m1


【解决方案1】:

正如您在此处看到的https://pkgs.alpinelinux.org/packages?name=syslinuxsyslinux 引导加载程序包不支持aarch64(M1 处理器)。我建议使用另一个支持 AMD 和 ARM 的引导加载程序 - 例如 https://pkgs.alpinelinux.org/packages?name=u-boot&branch=edge

如果您想在 M1 处理器上运行它而不会出错,请不要忘记将入口点中的 --arch x86_64 参数更改为 --arch aarch64。或者只是删除它以使用 sh 脚本中的default_arch

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-11-11
    • 2021-06-11
    • 2023-02-17
    • 2021-09-23
    • 1970-01-01
    • 1970-01-01
    • 2021-09-23
    • 1970-01-01
    相关资源
    最近更新 更多