来自守护程序的错误响应:创建挂载源路径时出错,权限被拒绝

Error response from daemon: error while creating mount source path permission denied

这是我的 K8s postgress 配置

apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      component: postgres
  template:
    metadata:
      labels:
        component: postgres
    spec:
      volumes:
        - name: postgres-storage
          persistentVolumeClaim:
            claimName: database-persistent-volume-claim
      containers:
      - name: postgres
        image: postgres
        ports:
        - containerPort: 5432
        volumeMounts:
          - mountPath: /var/lib/postgresql/data
            name: postgres-storage

以下是事件日志

Events:
  Type     Reason     Age                From                     Message
  ----     ------     ----               ----                     -------
  Normal   Scheduled  35s                default-scheduler        Successfully assigned default/postgres-deployment-d57b94d8-qnk8j to docker-desktop
  Normal   Pulling    11s (x3 over 34s)  kubelet, docker-desktop  Pulling image "postgres"
  Normal   Pulled     6s (x3 over 30s)   kubelet, docker-desktop  Successfully pulled image "postgres"
  Normal   Created    6s (x3 over 29s)   kubelet, docker-desktop  Created container postgres
  Warning  Failed     6s (x3 over 29s)   kubelet, docker-desktop  Error: failed to start container "postgres": Error response from daemon: error while creating mount source path '/host_mnt/c/Users/DupinderDhiman/.docker/Volumes/database-persistent-volume-claim/pvc-c8155b21-10d9-11ea-b05a-00155d380104': mkdir /host_mnt/c/Users/DupinderDhiman/.docker: permission denied

是的,我知道你会说,共享驱动器。 我做了 docker run --rm -v c:/Users:/data alpine ls /data

All Users
CatalystOne
Default
Default User
DupinderDhiman
Public
desktop.ini

这个命令运行得很好

所以问题与驱动器共享无关

好的,下一个问题可能与 c:/specificFolder 权限有关。我检查了共享权限中的所有复选框

现在我卡住了

所以花了一些时间后,我记得我创建了一个用户来为 Docker 共享驱动器,名称为 dockerUser

所以我授予的权限仅适用于 Administrative user 我自己的用户 DupinderDhiman 但不适用于 dockerUser

所以转到 C:/user/DupinderDhiman/.docker 右键单击​​转到属性转到 security tab 点击 Edit 按钮 "To change permission, click Edit" 然后点击 Add 按钮

现在点击 Advance > 然后在新对话中找到底部的 Find 按钮,你会找到一个列表,找到 DockerUser > Select 按下 okay

好的 好的 好的 > 应用更改

关闭所有打开的对话框,确定应用更改和 运行 命令。看到你现在不会有这个错误了。