我正在尝试构建一个可以在没有错误的情况下运行入口点的docker映像:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/app\": permission denied": unknown.
我的操作系统:Windows 10
Dockerfile内容:
ARG GO_VERSION=1.11
FROM golang:${GO_VERSION}-alpine AS builder
RUN mkdir /user && \
echo 'nobody:x:65534:65534:nobody:/:' > /user/passwd && \
echo 'nobody:x:65534:' > /user/group
RUN apk add --no-cache ca-certificates
ENV CGO_ENABLED=0 GOFLAGS=-mod=vendor
WORKDIR $GOPATH/src/XXXXmyrepoXXXX
COPY ./ ./
RUN go build \
-installsuffix 'static' \
-o /app .
FROM scratch AS final
COPY --from=builder /user/group /user/passwd /etc/
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /app /app
EXPOSE 8080
USER nobody:nobody
ENTRYPOINT ["/app"]
我应该如何更改Dockerfile,它应该和https://medium.com/@pierreprinetti/the-go-1-11-dockerfile-a3218319d191一样工作?实际上没有任何变化。
答案 0 :(得分:0)
错误是我没有去建立正确的路径。