Here's my Dockerfile:
FROM alpine:latest
COPY ./main .
COPY ./configs/. .
EXPOSE 8081
CMD ["/main"]
If I do docker run -it --entrypoint=/bin/sh metadata
I can see the /main
file is there and is executable
/ # ls -lart /main
-rwxrwxr-x 1 root root 15352712 May 29 19:16 /main
This is a Go binary so there are no unsatisfied dependencies.
When I try to run it it says that the /main
file doesn't exist, even though it is there:
$ docker run -p 8081:8081 -it metadata
exec /main: no such file or directory
Is this a bug in docker?
I'm running docker 20.10.21 on Ubuntu 22.04.
--Edit--
I've tried running the /main
binary from within docker and the Alpine distro can't find it to exec it:
$ docker run -it --entrypoint=/bin/sh metadata
/ # ls -l /main
-rwxrwxr-x 1 root root 15352712 May 29 19:16 /main
/ # /main
/bin/sh: /main: not found
/ # ls
base.yaml dev home main mnt proc run srv tmp var
bin etc lib media opt root sbin sys usr
/ # ./main
/bin/sh: ./main: not found
/ # main
/bin/sh: main: not found