首页 > 解决方案 > Docker 映像 google/cloud-sdk gcloud builds submit 命令失败,错误 gcloud crashed (FileNotFoundError)

问题描述

我正在使用 Docker Image 'google/cloud-sdk' 并在容器中使用 command gcloud builds submit --tag gcr.io/my-project/my-repo

但是这个命令会导致下一个错误ERROR: gcloud crashed (FileNotFoundError): [Errno 2] No such file or directory: './proc/42/task/42/fdinfo/5'

我也使用命令gcloud beta run deploy,这是成功的。

如果有人知道这个问题,请告诉我。

环境
google/cloud-sdk:278
认证:gcloud auth activate-service-account ~

# gcloud version
Google Cloud SDK 278.0.0
alpha 2020.01.24
app-engine-go 
app-engine-java 1.9.78
app-engine-python 1.9.88
app-engine-python-extras 1.9.88
beta 2020.01.24
bigtable 
bq 2.0.52
cbt 
cloud-datastore-emulator 2.1.0
core 2020.01.24
datalab 20190610
gsutil 4.47
kubectl 2020.01.24
pubsub-emulator 0.1.0

标签: dockergoogle-cloud-platformgcloudgoogle-cloud-build

解决方案


该错误并不理想(!?),但以下内容对我有用:

PROJECT=[[YOUR-PROJECT]]
BILLING=[[YOUR-BILLING]]

gcloud projects create ${PROJECT}
gcloud beta billing projects link ${PROJECT} --billing-account=${BILLING}

gcloud services enable containerregistry.googleapis.com --project=${PROJECT}
gcloud services enable cloudbuild.googleapis.com --project=${PROJECT}

touch quickstart.sh Dockerfile # Add content etc.

docker run \
--interactive --tty \
--env=CLOUDSDK_CONFIG=/config/mygcloud \
--volume=${HOME}/.config/gcloud:/config/mygcloud \
--volume=${PWD}:/59980120 \
google/cloud-sdk gcloud builds submit /59980120 \
--project=${PROJECT} \
--tag=gcr.io/${PROJECT}/freddie

编辑输出:

Creating temporary tarball archive of 10 file(s) totalling 34.2 KiB before compression.
Uploading tarball of [/59980120] to [gs://...
starting build "7bb29351-e947-408c-9b3b-72fed105b336"

FETCHSOURCE
Fetching storage object: gs://...
Copying gs://...
/ [1 files][  2.2 KiB/  2.2 KiB]                                                
Operation completed over 1 objects/2.2 KiB.                                      
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon  46.59kB
Step 1/3 : FROM alpine
latest: Pulling from library/alpine
c9b1b535fdd9: Pulling fs layer
c9b1b535fdd9: Verifying Checksum
c9b1b535fdd9: Download complete
c9b1b535fdd9: Pull complete
Digest: sha256:ddba4d27a7ffc3f86dd6c2f92041af252a1f23a8e742c90e6e1297bfa1bc0c45
Status: Downloaded newer image for alpine:latest
 ---> e7d92cdc71fe
Step 2/3 : COPY quickstart.sh /
 ---> c76655cf6a85
Step 3/3 : CMD ["/quickstart.sh"]
 ---> Running in b788dcf0de88
Removing intermediate container b788dcf0de88
 ---> 92005e24a933
Successfully built 92005e24a933
Successfully tagged gcr.io/...
PUSH
Pushing gcr.io/...
The push refers to repository [gcr.io/...]
3615e77170c7: Preparing
5216338b40a7: Preparing
5216338b40a7: Layer already exists
3615e77170c7: Pushed
latest: digest: sha256:4374028a72533ca5d14b094005ebeb4aa50fe0521738d8508434f0bd3d7a9dc3 size: 735
DONE

推荐阅读