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

1.8k views Asked by At

I'm trying to build a docker image using Gitlab-CI for linux/arm/v7 platform but unfortunately I'm facing the following error:

[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:

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:

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?

1

There are 1 answers

2
AAber On

Disable selinux on the host and retry your docker build.

See https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ for instructions.