我看了一下这个项目,最终成功在Cloud Run上运行。
首先,你不能从Google容器注册表或Artifact Registry之外拉取镜像。因此,你需要在GCP中拉取镜像,标记它并推送它(可以是你的项目或不是你的项目,但必须在GCP上)。
以下是步骤:
# Pull the image (I did it on Cloud Shell)
docker pull thecodingmachine/gotenberg:6
# Tag the image
docker tag thecodingmachine/gotenberg:6 gcr.io/<MY_PROJECT_ID>/thecodingmachine/gotenberg:6
#Push the image (no authentication issue on Cloud Shell)
docker push gcr.io/<MY_PROJECT_ID>/thecodingmachine/gotenberg:6
# Deploy on Cloud Run
gcloud run deploy --image=gcr.io/<MY_PROJECT_ID>/thecodingmachine/gotenberg:6 \
--port=3000 --region=us-central1 --allow-unauthenticated --platform=managed \
--command=gotenberg gotenberg
/tini
),并且容器构建可能不太好,因为存在权限问题。有关详细信息,请参见 Dockerfile然后,使用 Cloud Run URL 而不是文档中的 http://localhost:3000
,然后尽情享受吧!
tini
没有问题。 tini
应该可以正常工作。 - ahmet alp balkanchmod +x
,但我不知道为什么在Cloud Run日志中没有指定command
参数时会出现“终止:应用程序启动失败:无法创建init进程:无法加载/tini:权限被拒绝”的错误。你可以试一下。 - guillaume blaquieregcloud auth configure-docker
。 - thisjustindocker build
命令创建图像。此图像可以推送到像DockerHub这样的容器注册表。 - eddexgrafana/grafana-oss
,如果你想使用特定版本,则输入类似grafana/grafana-oss:9.5.12
的内容。 - undefined
thecodingmachine/gotenberg
或docker.io/thecodingmachine/gotenberg
?尽管它被标记为“URL”,但图像中的示例实际上并不是标准的URL。 - David Maze