title: How to enable persistent volumes on Kubernetes for docker in docker?
body: <p>to speed up docker build on kubernetes, I want to enable persistent volumes
  I tried this:</p>
  <pre><code>apiVersion: v1
  kind: Pod
  metadata:
    name: docker-build
  spec:
    volumes:
    - name: dind-storage
      # emptyDir: {}                    # that's how it works
      persistentVolumeClaim:            # so it doesn't work
        claimName: &quot;jenkinslibdocker&quot;    
    containers:
    - name: docker
      image: docker:19.03.3-git
      command:
      - cat
      tty: true
      env:
      - name: DOCKER_HOST
        value: tcp://localhost:2375
    - name: dind
      image: docker:19.03.3-dind
      securityContext:
        privileged: true
      env:
      - name: DOCKER_TLS_CERTDIR
        value: ''
      args:
      - &quot;--mtu=1440&quot;
      volumeMounts:
        - name: dind-storage
          mountPath: /var/lib/docker
  </code></pre>
  <p>I create the pod:</p>
  <pre><code>kubectl create -f test2.yaml
  </code></pre>
  <p>and the pvc:</p>
  <pre><code>kubectl create -f pvc.yaml
  
  
  
  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: jenkinslibdocker
  spec:
    accessModes:
      - ReadWriteOnce
    resources:
      requests:
        storage: 10Gi
    storageClassName: nfs-client
    volumeMode: Filesystem
  </code></pre>
  <p>Enter in the pod:</p>
  <pre><code>kubectl exec -it docker-build -c docker sh
  </code></pre>
  <p>Try to build anything</p>
  <pre><code>docker build https://github.com/liejuntao001/docker_doxygen.git --build-arg BUILDKIT_INLINE_CACHE=1 --tag baibai/doxygen:latest --cache-from baibai/doxygen:latest
  </code></pre>
  <p>i get the error:
  failed to register layer: operation not supported</p>
  <p>If I disable the persistent volume, it works</p>
  <p>Some idea ?</p>