I have the following Dockerfile...
FROM gliderlabs/alpine
WORKDIR /go/src/app
ADD menu-api menu-api
ENTRYPOINT ["menu-api"]
CMD ["menu-api"]
If I build my go binary using $ GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build
then build my Docker image $ docker build -t menu-api .
Then attempt to run my Docker image using $ docker run menu-api
. I get the following error:
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
As it turns out, I needed to do...
CMD ["./menu-api"]
Instead of...
CMD ["menu-api"]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.