我在Google Cloud Run上创建了一个服务,可以使用容器仓库中的映像通过Google Cloud Console UI手动部署。但是从命令行界面部署失败了。以下是我正在使用的命令和错误信息,我无法理解我缺少了什么:
$ gcloud beta run deploy service-name --platform managed --region region-name --image image-url
Deploying container to Cloud Run service [service-name] in project [project-name] region [region-name]
X Deploying...
. Creating Revision...
. Routing traffic...
Deployment failed
ERROR: (gcloud.beta.run.deploy) INVALID_ARGUMENT: The request has errors
- '@type': type.googleapis.com/google.rpc.BadRequest
fieldViolations:
- description: spec.revisionTemplate.spec.container.ports should be empty
field: spec.revisionTemplate.spec.container.ports
更新1:
我已使用gcloud components update
更新了SDK,但仍然存在同样的问题。
这是我的SDK版本:
$gcloud version
Google Cloud SDK 270.0.0
beta 2019.05.17
bq 2.0.49
core 2019.11.04
gsutil 4.46
我正在使用多阶段Docker构建。这是我的Dockerfile:
FROM custom-dev-image
COPY . /project_dir
WORKDIR /project_dir
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
/usr/local/bin/go build -a \
-ldflags '-w -extldflags "-static"' \
-o /root/go/bin/executable ./cmds/project/main.go
FROM alpine:3.10
ENV GIN_MODE=release APP_NAME=project_name
COPY --from=0 /root/go/bin/executable /usr/local/bin/
CMD executable
gcloud version
吗?你能分享一下你的Dockerfile吗? - guillaume blaquieregcloud components update
。 - John Hanley