How to see the files running on my Google Cloud Platform Cloud Run service?

Viewed 1792

A team who worked on a project deployed a docker image to a cloud run service. I do not have the docker image but I have access to the Cloud Run service. I can see the logs and details. I would like to find the files that were in that docker image. How can I access this? For example the image contained a main.py file, now I want to access this.

Thanks

1 Answers

Since Cloud Run uses docker images, you can use the GCP cloud shell (Cloud shell already has docker installed).

Also, you need get the container registry image used for your cloud run service, to get it, please follow this steps:

1.- Choose your service from the cloud run services list

2.- In the service page, go to revision tab.

3.- Click on image URL.

4.- In the image details page, click on Show Pull Command and the image used will have the following format gcr.io/[imagename] for example gcr.io/cloudrun/hello:latest

In cloud shell run the following command

docker run -it --entrypoint sh {image-name}

For example:

docker run -it --entrypoint sh gcr.io/cloudrun/hello

This command will open a new shell within your docker container (to exit hit, ctrl+d), run the command ls -lah to see the files within your docker image, to see the content of any file use the cat command.

*your google account used in Google Cloud Console must have access to the container registry image

Related