Given is a very simple Dockerfile, build and run on Windows 11. The dockerfile has two stages, first the building stage, and then the actual deployable container.
FROM golang:1.17 AS builder
WORKDIR /app
COPY . .
RUN go build -o myapp . # build /app/myapp
FROM alpine:3.14
RUN apk add --no-cache ca-certificates
COPY --from=builder /app/myapp /myapp
EXPOSE 8080
ENTRYPOINT ["/myapp"]
Running the container fails with the following error:
/myapp: not found
I inspected the first stage, it generated an executable file called myapp with 5984 bytes. I can run and execute it there.
I also inspected the second stage and I can verify that /myapp exists with 5984 and the correct execution bits. Being in inspection mode via sh I cannot execute /myapp since it gives me the same error. Any idea what might cause this?