简体   繁体   中英

Docker image google/cloud-sdk gcloud builds submit command failed with error gcloud crashed (FileNotFoundError)

I am using Docker Image 'google/cloud-sdk' and in the container I use the command gcloud builds submit --tag gcr.io/my-project/my-repo .

But this command causes the next error ERROR: gcloud crashed (FileNotFoundError): [Errno 2] No such file or directory: './proc/42/task/42/fdinfo/5' .

I also use the command gcloud beta run deploy and this is success.

If anyone knows this problem, please tell me about it.

Environment
google/cloud-sdk:278
Authentication: 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

The error's not ideal (!?) but the following worked for me:

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

Redacted output:

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

I ran into the same problem today and the reason was that I tried to run

gcloud builds submit --tag gcr.io/my-project/my-repo. 

from the root folder of my docker container. I'm not entirely sure what is causing the problem but the fix is quite simple.

In interactive mode, simply cd into another directory, for instance:

cd /home

If you're building a docker image on top of the cloudsdk image, consider setting the WORKDIR like this:

WORKDIR /home

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM