I am trying to create the docker image of an app that was developed in Go. I have the binary called myapp, and if I execute it then it work correctly, I execute it with:
./myapp
Then, take that bin and put it alone in a directory called mydirectory
and inside I put this dockerfile:
# iron/go is the alpine image with only ca-certificates added
FROM iron/go
WORKDIR /
# Now just add the binary
ADD myapp /
ENTRYPOINT ["./myapp"]
and then I create the docker image by typing:
docker build -t myDockerHubUser/myapp .
Then, when I run the image I get this message:
standard_init_linux.go:185: exec user process caused "no such file or directory"
What does it mean? I found some post related with the same message but the thing is that my bnary is executed correctly without any problems
You most likely either:
You can use CGO_ENABLED=0
to build your binary statically.
You have to build the binary inside docker not in your machine.
FROM golang
ADD ./ /go/src/app
WORKDIR /go/src/app
RUN go get ./
RUN go build
CMD app
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With