Using a FROM scratch container I am getting this error:
standard_init_linux.go:195: exec user process caused "no such file or directory"
My dockerfile is simple:
FROM scratch
ADD main /
CMD ["/main"]
main is a go binary. It works just fine with a hello world app, but fails for larger projects.
I built the go binary using these flags:
CGO_ENABLED=0
GOOS=linux
And I’ve also tried adding -ldflags '-w -extldflags "-static"'
The binary is building just fine and works in a regular Linux container.
This error message doesn’t give me much of a clue what might be the error. Any ideas what would be causing a file to not be found in such a simple dockerfile?
Thanks for the reply. This is a FROM scratch container so you cannot attach in. Also, there is only 1 file, main which is clearly added in the Dockerfile.
I’m confused why this would be an issue with the executable, the error I am getting is with Docker not being able to find a file. This seems like a Docker bug. Is there somewhere I should report it?