从Docker创建Alpine Linux ISO-libburn权限被拒绝

时间:2019-03-24 13:12:09

标签: docker iso alpine

我一直在按照标准here尝试在docker容器内为alpine-linux构建iso-image,但是由于libburn,我似乎无法将.iso实际写回到已安装的卷中:

    >>> mkimage-x86_64: Creating alpine-standard-edge-x86_64.iso
xorriso 1.4.8 : RockRidge filesystem manipulator, libburnia project.

libburn : SORRY : Failed to open device (a pseudo-drive) : Permission denied
libburn : FATAL : Burn run failed
xorriso : FATAL : -abort_on 'FAILURE' encountered 'FATAL' during image writing
libisofs: MISHAP : Image write cancelled
xorriso : FAILURE : libburn indicates failure with writing.

这是尝试运行本教程中下载的脚本的标准结果:

sh aports/scripts/mkimage.sh --tag edge --outdir /build2/ --arch x86_64 --repository http://dl-cdn.alpinelinux.org/alpine/edge/main --profile standard

使用以下命令的docker镜像

FROM alpine:latest
RUN addgroup root abuild
RUN apk add --update \
    alpine-sdk \
   # build-base \
    apk-tools \
    alpine-conf \
    busybox \
    git \
    fakeroot \
    syslinux \
    xorriso \
    squashfs-tools \
    mtools \
    dosfstools \
    grub-efi \
  && rm -rf /var/cache/apk/*

COPY . /usr/src/app 
WORKDIR /usr/src/app
RUN mkdir /usr/src/app/build
RUN touch /usr/src/app/build/worked.txt
RUN adduser -G abuild -g "Alpine Package Builder" -s /bin/sh -u 12345 -D builder
RUN echo "builder:newpass"|chpasswd


RUN chgrp -R abuild /usr/local;                                      \
    find /usr/local -type d | xargs chmod g+w;                        \
    echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/builder; \
    chmod 0440 /etc/sudoers.d/builder

WORKDIR /build2/
RUN git clone git://git.alpinelinux.org/aports
RUN chmod +x aports/scripts/mkimage.sh
RUN abuild-keygen -i -a
USER builder

我看过官方论坛,但是只有一个帖子提到了类似的内容,但并未暗示任何实际的解决方案。

未能找到解决方案,其他人能否推荐一个好的替代最小发行版,该发行版可以通过脚本针对x_86,x_64和rpi构建一个iso?

2 个答案:

答案 0 :(得分:2)

您可以使用脚本alpine-make-vm-image轻松创建自己的Alpine Linux ISO映像。

示例:

sudo ./alpine-make-vm-image \
  --image-format qcow2 \
  --image-size 5G \
  --packages "ca-certificates git ssl_client" \
  --script-chroot \
  alpine-$(date +%Y-%m-%d).qcow2 -- ./configure.sh

答案 1 :(得分:0)

您收到一个权限被拒绝的错误,因为您创建的用户无法访问xorriso所需的伪设备。我删除了所有用户创建部分,并以root用户身份运行了整个程序,

这是我使用的Dockerfile:

FROM alpine:latest

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

WORKDIR /src

RUN git clone git://git.alpinelinux.org/aports

RUN chmod +x aports/scripts/mkimage.sh

RUN addgroup root abuild

RUN abuild-keygen -i -a -n

WORKDIR /build

ENTRYPOINT /src/aports/scripts/mkimage.sh

CMD "--tag edge --arch x86_64 --repository http://dl-cdn.alpinelinux.org/alpine/edge/main --profile standard"

然后构建并运行。

docker build -t alpine-iso .

docker run -v "$(pwd):/build" -it alpine-iso