我试图从谷歌云sdk环境下载一个项目文件,从谷歌云支持得到一个docker命令。
我遵循这些指令:
[![1]][1]
我能够运行几乎所有的命令,但是docker cp命令遇到了一个错误"A required privilege is not held by the client."
下面是我做的:
C:Users*AppDataLocalGoogleCloud SDK>gcloud auth login
Your browser has been opened to visit:
https://accounts.google.com/o/oauth2/auth---
You are now logged in as [*@gmail.com].
Your current project is [nodejs-301100]. You can change this setting by running:
$ gcloud config set project PROJECT_ID
C:Users*AppDataLocalGoogleCloud SDK>gcloud auth configure-docker
WARNING: Your config file at [C:Users*.dockerconfig.json] contains these credential helper entries:
{
"credHelpers": {
"gcr.io": "gcloud",
"us.gcr.io": "gcloud",
"eu.gcr.io": "gcloud",
"asia.gcr.io": "gcloud",
"staging-k8s.gcr.io": "gcloud",
"marketplace.gcr.io": "gcloud"
}
}
Adding credentials for all GCR repositories.
WARNING: A long list of credential helpers may cause delays running 'docker build'. We recommend passing the registry name to configure only the registry you are using.
gcloud credential helpers already registered correctly.
C:Users*AppDataLocalGoogleCloud SDK>docker pull asia.gcr.io/nodejs 301100/appengine/default.20210108t204554:latest
latest: Pulling from nodejs-301100/appengine/default.20210108t204554
Digest: sha256:a1bf8c73e54a357b9aa3d251e73deb0f8ffba4eecef9c6767efa666f3781c600
Status: Image is up to date for asia.gcr.io/nodejs-301100/appengine/default.20210108t204554:latest
asia.gcr.io/nodejs-301100/appengine/default.20210108t204554:latest
C:Users*AppDataLocalGoogleCloud SDK>docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
asia.gcr.io/nodejs-301100/appengine/default.20210108t204554 latest b0c9100e95b4 4 weeks ago 741MB
C:Users*AppDataLocalGoogleCloud SDK>docker run -d b0c9100e95b4
34600f7b8b20238c816a53c8dd08e19fcc0496628139d9c9251e7ad5683ef837
C:Users*AppDataLocalGoogleCloud SDK>docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
34600f7b8b20 b0c9100e95b4 "/bin/sh -c 'npm sta…" 41 seconds ago Up 40 seconds angry_einstein
77bcc0536ac9 b0c9100e95b4 "/bin/sh -c 'npm sta…" 20 minutes ago Up 20 minutes goofy_feistel
C:Users*AppDataLocalGoogleCloud SDK>docker exec -it goofy_feistel pwd
/app
C:Users*AppDataLocalGoogleCloud SDK>docker cp goofy_feistel:app/ google-cloud-sdk
symlink ..ejsbincli.js C:Users*AppDataLocalGoogleCloud SDKgoogle-cloud sdkappnode_modules.binejs: A required privilege is not held by the client.
我该怎么办?
这是操作系统权限问题- Docker无法访问某些文件;
修复客户端不持有所需特权的问题错误:错误0x80070522意味着您正在尝试复制或创建一个目录内的文件,而您没有所需的权限或特权。一般来说,当你试图复制、粘贴或修改Windows文件夹中的内容时,你会遇到这个错误,而微软不允许未经授权的访问Windows安装。甚至用户也会被提示错误" A Required Privilege Is Not hold By the Client error ",因为这些文件只能被唯一的系统严格访问。
快速的方法是使用"administrator"打开命令提示符并再次运行命令。
在类似的问题中可以找到一些线索:
- Robocopy错误- "所需的特权不被客户端持有">
- 我可以改变日期和时间在一个Windows Docker容器?
和"工作区"github讨论@Mahboob链接在评论。
下面是John Hanley建议的正确方法:
在Administrators提示符中运行命令不是一个好的解决方案,并且有安全隐患。正确的解决方案是将用户添加到正确的组,从而取消对管理员权限的需求
这是如何做到这一点;下面是另一个例子。
cmd (run as admin)
帮我解决了