to speed up docker build on kubernetes, I want to enable persistent volumes I tried this:
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: "jenkinslibdocker"
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:
- "--mtu=1440"
volumeMounts:
- name: dind-storage
mountPath: /var/lib/docker
I create the pod:
kubectl create -f test2.yaml
and the pvc:
kubectl create -f pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jenkinslibdocker
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: nfs-client
volumeMode: Filesystem
Enter in the pod:
kubectl exec -it docker-build -c docker sh
Try to build anything
docker build https://github.com/liejuntao001/docker_doxygen.git --build-arg BUILDKIT_INLINE_CACHE=1 --tag baibai/doxygen:latest --cache-from baibai/doxygen:latest
i get the error: failed to register layer: operation not supported
If I disable the persistent volume, it works
Some idea ?