我有以下Dockerfile ......
FROM gliderlabs/alpine
WORKDIR /go/src/app
ADD menu-api menu-api
ENTRYPOINT ["menu-api"]
CMD ["menu-api"]
如果我使用$ GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build
构建我的go二进制文件,那么构建我的Docker镜像$ docker build -t menu-api .
然后尝试使用$ docker run menu-api
运行我的Docker镜像。我收到以下错误:
container_linux.go:262: starting container process caused "exec: \"menu-api\": executable file not found in $PATH"
docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "exec: \"menu-api\": executable file not found in $PATH".
ERRO[0000] error waiting for container: context canceled
答案 0 :(得分:0)
事实证明,我需要做......
CMD ["./menu-api"]
而不是......
CMD ["menu-api"]