首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从Go hangs与Google API交谈

从Go hangs与Google API交谈
EN

Stack Overflow用户
提问于 2019-04-12 11:42:13
回答 1查看 106关注 0票数 1

按照示例here,代码似乎挂起了通过gRPC连接到Google的https。

同样的代码也适用于App Engine Go1.11和App Engine Flex。这是我的Dockerfile

代码语言:javascript
复制
# Use the offical Golang image to create a build artifact.
# This is based on Debian and sets the GOPATH to /go.
# https://hub.docker.com/_/golang
FROM golang:1.12 as builder

# Copy local code to the container image.
WORKDIR /go/src/serverless
COPY . .

# Build the command inside the container.
# (You may fetch or manage dependencies here,
# either manually or with a tool like "godep".)
RUN go get . && CGO_ENABLED=0 GOOS=linux go build -v -o serverless

# Use a Docker multi-stage build to create a lean production image.
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM alpine

# Copy the binary to the production image from the builder stage.
COPY --from=builder /go/src/serverless/serverless /serverless

# Run the web service on container startup.
CMD ["/serverless"]
EN

回答 1

Stack Overflow用户

发布于 2019-04-12 11:44:57

稍加调试后,这似乎与容器中没有根证书有关。在FROM alpine之后添加以下行

代码语言:javascript
复制
# Enable the use of outbound https
RUN apk add --no-cache ca-certificates

修复了该问题。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55644181

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档