moby icon indicating copy to clipboard operation
moby copied to clipboard

failed to walk: failed to xattr

Open jclab-joseph opened this issue 3 years ago • 2 comments

Description

Getting the following two errors repeatedly:

[+] Building 0.0s (0/0)                                                                                                                                                                                            
[+] Building 0.0s (0/0)                                                                                                                                                                                            
[+] Building 0.2s (2/2) FINISHED                                                                                                                                                                                   
 => [internal] load .dockerignore                                                                                                                                                                             0.1s
 => => transferring context: 2B                                                                                                                                                                               0.0s
 => ERROR [internal] load build definition from Dockerfile                                                                                                                                                    0.1s
 => => transferring dockerfile: 30B                                                                                                                                                                           0.0s
------
 > [internal] load build definition from Dockerfile:
------
2022/11/22 15:04:43 INFO: [core] [Channel #1] Channel Connectivity change to SHUTDOWN
2022/11/22 15:04:43 INFO: [core] [Channel #1 SubChannel #2] Subchannel Connectivity change to SHUTDOWN
2022/11/22 15:04:43 INFO: [core] [Channel #1 SubChannel #2] Subchannel deleted
2022/11/22 15:04:43 INFO: [core] [Channel #1] Channel deleted
ERROR: failed to solve: failed to read dockerfile: failed to walk: failed to xattr /var/lib/buildkit/runc-overlayfs/snapshots/snapshots/7/fs/Dockerfile: input/output error
 => ERROR [stage-1 1/1] COPY --from=builder /test01 /test01                                                                                                                                                   0.0s
------
 > [stage-1 1/1] COPY --from=builder /test01 /test01:
------
Dockerfile:7
--------------------
   5 |     
   6 |     FROM scratch
   7 | >>> COPY --from=builder /test01 /test01
   8 |     
   9 |     
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 9osltmzfc8ps86p2vhxs7z7fk::w4kd3dko7cqw4w8vokhxclqif: failed to create hash for /test01: input/output error

Buildkit Docker Container Log:

time="2022-11-22T05:57:03Z" level=error msg="/moby.buildkit.v1.Control/Solve returned error: rpc error: code = Unknown desc = failed to compute cache key: failed to calculate checksum of ref 9osltmzfc8ps86p2vhxs7z7fk::w4kd3dko7cqw4w8vokhxclqif: failed to create hash for /test01: input/output error\n"
time="2022-11-22T05:57:39Z" level=error msg="/moby.buildkit.v1.frontend.LLBBridge/Solve returned error: rpc error: code = Unknown desc = failed to read dockerfile: failed to walk: failed to xattr /var/lib/buildkit/runc-overlayfs/snapshots/snapshots/2/fs/Dockerfile: input/output error\n"
time="2022-11-22T05:57:39Z" level=error msg="/moby.buildkit.v1.Control/Solve returned error: rpc error: code = Unknown desc = failed to read dockerfile: failed to walk: failed to xattr /var/lib/buildkit/runc-overlayfs/snapshots/snapshots/2/fs/Dockerfile: input/output error\n"
time="2022-11-22T05:58:24Z" level=error msg="/moby.buildkit.v1.Control/Solve returned error: rpc error: code = Unknown desc = failed to compute cache key: failed to calculate checksum of ref 9osltmzfc8ps86p2vhxs7z7fk::w4kd3dko7cqw4w8vokhxclqif: failed to create hash for /test01: input/output error\n"
time="2022-11-22T05:59:13Z" level=error msg="/moby.buildkit.v1.frontend.LLBBridge/Solve returned error: rpc error: code = Unknown desc = failed to read dockerfile: failed to walk: failed to xattr /var/lib/buildkit/runc-overlayfs/snapshots/snapshots/6/fs/Dockerfile: input/output error\n"
time="2022-11-22T05:59:14Z" level=error msg="/moby.buildkit.v1.Control/Solve returned error: rpc error: code = Unknown desc = failed to read dockerfile: failed to walk: failed to xattr /var/lib/buildkit/runc-overlayfs/snapshots/snapshots/6/fs/Dockerfile: input/output error\n"
time="2022-11-22T06:03:50Z" level=error msg="/moby.buildkit.v1.Control/Solve returned error: rpc error: code = Unknown desc = failed to compute cache key: failed to calculate checksum of ref 9osltmzfc8ps86p2vhxs7z7fk::w4kd3dko7cqw4w8vokhxclqif: failed to create hash for /test01: input/output error\n"
time="2022-11-22T06:04:42Z" level=error msg="/moby.buildkit.v1.frontend.LLBBridge/Solve returned error: rpc error: code = Unknown desc = failed to read dockerfile: failed to walk: failed to xattr /var/lib/buildkit/runc-overlayfs/snapshots/snapshots/7/fs/Dockerfile: input/output error\n"
time="2022-11-22T06:04:43Z" level=error msg="/moby.buildkit.v1.Control/Solve returned error: rpc error: code = Unknown desc = failed to read dockerfile: failed to walk: failed to xattr /var/lib/buildkit/runc-overlayfs/snapshots/snapshots/7/fs/Dockerfile: input/output error\n"
time="2022-11-22T06:50:45Z" level=error msg="/moby.buildkit.v1.Control/Solve returned error: rpc error: code = Unknown desc = failed to compute cache key: failed to calculate checksum of ref 9osltmzfc8ps86p2vhxs7z7fk::w4kd3dko7cqw4w8vokhxclqif: failed to create hash for /test01: input/output error\n"

Dockerfile:

FROM alpine:3.16 as builder

RUN apk add bash
RUN echo "HELLO WORLD" > /test01

FROM scratch
COPY --from=builder /test01 /test01

Reproduce

$ docker context create temp01 --docker "host=tcp://dockerd....:2376,ca=tls/ca.crt,cert=tls/tls.crt,key=tls/tls.key"
$ export DOCKER_CONTEXT=temp01
$ docker buildx create --name temp02 --driver docker-container
$ docker buildx --builder=temp02 build --tag=test .

Expected behavior

No response

docker version

Client:
 Version:           22.06.0-beta.0
 API version:       1.42
 Go version:        go1.18.3
 Git commit:        3e9117b
 Built:             Fri Jun  3 17:52:19 2022
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          22.06.0-beta.0
  API version:      1.42 (minimum version 1.12)
  Go version:       go1.18.3
  Git commit:       38633e79
  Built:            Fri Jun  3 17:57:22 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.6.4
  GitCommit:        212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
 runc:
  Version:          1.1.2
  GitCommit:        v1.1.2-0-ga916309f
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.9.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.12.2
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 22.06.0-beta.0
 Storage Driver: overlay2
  Backing Filesystem: fuse
  Supports d_type: true
  Using metacopy: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
 runc version: v1.1.2-0-ga916309f
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
 Kernel Version: 5.19.2
 Operating System: Alpine Linux v3.16 (containerized)
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 5.848GiB
 Name: dockerd-65f95b6f58-w2f95
 ID: 524f7d09-0cc3-4630-ad80-740c69f36852
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Additional Info

  • Kata-containers 3.0.0
  • rootfs is mounted as virtiofs. (with -o xattr -o modcaps=+sys_admin -o allow_direct_io options)

jclab-joseph avatar Nov 22 '22 06:11 jclab-joseph

deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: dockerd
  name: dockerd
  namespace: gitlab-runners
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: dockerd
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: dockerd
    spec:
      containers:
      - args:
        - --debug
        - --mtu=1450
        image: docker:20.10.21-dind
        imagePullPolicy: IfNotPresent
        name: main
        ports:
        - containerPort: 2376
          name: docker
          protocol: TCP
        resources:
          limits:
            memory: 4Gi
          requests:
            memory: 1Gi
        securityContext:
          privileged: true
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /secrets/server-tls
          name: server-tls
        - mountPath: /certs
          name: certs
      dnsPolicy: ClusterFirst
      initContainers:
      - command:
        - /bin/sh
        - -c
        - mkdir -p /certs/ca /certs/server /certs/client && ln -s /secrets/server-tls/ca.crt
          /certs/ca/cert.pem && ln -s /secrets/server-tls/ca.crt /certs/server/ca.pem
          && ln -s /secrets/server-tls/tls.crt /certs/server/cert.pem && ln -s /secrets/server-tls/tls.key
          /certs/server/key.pem
        image: alpine:3.16
        imagePullPolicy: IfNotPresent
        name: init-cert
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /secrets/server-tls
          name: server-tls
        - mountPath: /certs
          name: certs
      - command:
        - sh
        - -c
        - sysctl -w fs.inotify.max_user_watches=100000 fs.inotify.max_user_instances=100000
        image: busybox
        imagePullPolicy: Always
        name: init-sys
        resources: {}
        securityContext:
          privileged: true
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      restartPolicy: Always
      runtimeClassName: kata-clh
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - name: server-tls
        secret:
          defaultMode: 420
          secretName: docker-server-tls
      - emptyDir: {}
        name: certs

client side:

docker context create context-01 --docker "host=${DOCKER_HOST},ca=${DOCKER_CLIENT_CERT_DIR}/ca.crt,cert=${DOCKER_CLIENT_CERT_DIR}/tls.crt,key=${DOCKER_CLIENT_CERT_DIR}/tls.key"
export BUILDER_NAME=builder-01
docker info
docker buildx create --use --name ${BUILDER_NAME} context-01
docker buildx build -t my-docker-image:1 . 
docker buildx --builder ${BUILDER_NAME} build -t my-docker-image:2 . 
docker buildx prune --builder ${BUILDER_NAME} -f

jclab-joseph avatar Jan 04 '23 09:01 jclab-joseph

Hm.. there's quite some moving parts in here; these could be relevant at least;

Additional Info

  • Kata-containers 3.0.0
  • rootfs is mounted as virtiofs. (with -o xattr -o modcaps=+sys_admin -o allow_direct_io options)

Also, in your example, it looks like you're using a container-builder;

docker buildx create --name temp02 --driver docker-container

In that case, the buildkit instance that's used is not the BuildKit instance in the docker engine, but a buildkit daemon running inside a container

@crazy-max should this one be transferred to the BuildKit repo?

thaJeztah avatar Jan 17 '23 11:01 thaJeztah

Opened on buildx too https://github.com/docker/buildx/issues/1718, closing this one.

crazy-max avatar Apr 17 '23 07:04 crazy-max