简体   繁体   English

Docker:无法复制 xattrs:无法设置 xattr“security.selinux”

[英]Docker: failed to copy xattrs: failed to set xattr "security.selinux"

I'm trying to build a docker image using Gitlab-CI for linux/arm/v7 platform but unfortunately I'm facing the following error:我正在尝试使用 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

My gitlab-ci.yml looks like:我的 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 .

And my Dockerfile is the following:而我的 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"]

Is anyone having any idea how I can solve the issue?有谁知道我该如何解决这个问题?

Disable selinux on the host and retry your docker build.在主机上禁用 selinux 并重试您的 docker 构建。

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

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

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