docker - 如何查看在我的 Google Cloud Platform Cloud Run 服

从事项目工作的团队将 docker 镜像部署到云运行服务。我没有 docker 镜像,但我可以访问 Cloud Run 服务。我可以看到日志和详细信息。我想找到那个 docker 镜像中的文件。我怎样才能访问它?例如图像包含一个 main.py 文件,现在我想访问它。

谢谢

最佳答案

由于 Cloud Run 使用 docker 镜像,您可以使用 GCP cloud shell (Cloud Shell 已经安装了 docker)。

此外,您还需要获取用于您的云运行服务的容器注册表镜像,要获取它,请按照以下步骤操作:

1.- 从 cloud run services list 中选择您的服务

2.- 在服务页面中,转到修订选项卡。

3.- 点击图片 URL。

4.- 在图片详细信息页面中,点击Show Pull Command,使用的图片将具有以下格式 gcr.io/[imagename] 例如 gcr.io/cloudrun/hello:latest

在云外壳中运行以下命令

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

例如:

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

此命令将在您的 docker 容器中打开一个新的 shell(退出命中,ctrl+d),运行命令 ls -lah 以查看您的文件docker 图像,使用 cat 命令查看任何文件的内容。

*您在 Google Cloud Console 中使用的 Google 帐户必须有权访问容器注册表镜像

关于docker - 如何查看在我的 Google Cloud Platform Cloud Run 服务上运行的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63747819/

相关文章:

c - main的地址是什么?

python - 类型错误 : request() missing 1 required posit

vue.js - 将插槽从 Vue 2 迁移到 Vue 3

python - 在列表字典中查找最大列表范围的更好(更简洁)方法是什么

angular - 使用@input 对 Angular 组件进行单元测试

python - 如何在 Python 中订阅 NATS 主题并继续接收消息?

python - Python 中的日期字符串格式化

html - 轮播滑动动画不适用于 Bootstrap 4.5.2

r - separate_rows 在结果周围生成引号

scala - 如何在不分配给 val 的情况下使用隐式调用返回的函数