0

我正在尝试使用 Gitlab-CI 为 linux/arm/v7 平台构建 docker 映像,但不幸的是我遇到了以下错误:

[3/7] RUN apt-get update
ERROR: executor failed running [/dev/.buildkit_qemu_emulator /bin/sh -c apt-get update]: failed to copy xattrs: failed to set xattr "security.selinux" on /tmp/buildkit-qemu-emulator135475847/dev/.buildkit_qemu_emulator: operation not supported
------
 > [3/7] RUN apt-get update:
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/dev/.buildkit_qemu_emulator /bin/sh -c apt-get update]: failed to copy xattrs: failed to set xattr "security.selinux" on /tmp/buildkit-qemu-emulator135475847/dev/.buildkit_qemu_emulator: operation not supported
Cleaning up file based variables
00:01
ERROR: Job failed: exit code 1

我的 gitlab-ci.yml 看起来像:

image: jdrouet/docker-with-buildx:stable

variables:
  DOCKER_HOST: tcp://docker:2375/
  DOCKER_DRIVER: overlay2

services:
  - docker:dind

build:
  stage: build
  before_script:
     - docker info
     - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
  script:
    - docker buildx create --use
    - docker buildx build --push --platform linux/arm/v7 -t $CI_REGISTRY_IMAGE .

我的 Dockerfile 如下:

ARG NODE_VERSION=lts-slim

FROM --platform=linux/arm/v7 node:${NODE_VERSION}
WORKDIR /home/node

RUN apt-get update
RUN apt-get install -y build-essential python
RUN npm install --global npm node-gyp

COPY . .

ARG NODE_ENV=production
ENV NODE_ENV ${NODE_ENV}

RUN npm ci

CMD ["npm", "start"]

有谁知道我该如何解决这个问题?

4

1 回答 1

0

在主机上禁用 selinux 并重试 docker 构建。

有关说明,请参阅https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/

于 2021-04-27T15:33:25.557 回答