Golang二进制文件无法在Docker容器中启动

时间:2018-12-03 16:32:07

标签: docker

我写了这个Dockerfile

Model.objects.raw("""SELECT * FROM document
                ORDER BY IF(date_of_rectification > date_of_signature,
                date_of_rectification, date_of_signature)""")

使用# Stage I FROM golang:alpine as builder RUN apk update && apk add --no-cache git ca-certificates COPY . $GOPATH/src/realtime_chat/chat WORKDIR $GOPATH/src/realtime_chat/chat RUN go get github.com/gorilla/websocket RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-w -s" -o /go/bin/chat # Stage II FROM alpine COPY ./views /go/bin/views COPY --from=builder /go/bin/chat /go/bin/chat ENTRYPOINT [ "/go/bin/chat" ] 启动容器后,容器开始工作了,但是我没有来自应用程序的响应。但是,如果我要进入容器,请通过键入docker run -d -p 80:80 image_name app start response手动停止并运行应用程序。 我试图公开端口,将入口点更改为cmd,更改基本映像(对于两个阶段)

0 个答案:

没有答案