'Docker unable to find file in Alpine Linux container

I have an application I'm creating a docker image for, the image is created but when I run it the container errors saying it cannot find the executable file.

Here is my docker file:

FROM alpine:3.14
WORKDIR /
EXPOSE 3000
COPY ./weather-api /weather-api
CMD ["/weather-api"]

I've included a RUN ls -la immediately above the CMD which shows the file is there whilst building the image is being built, and I've included a shell script with la -la as the CMD which has shows that the files is there when the image is being ran.

This is the error I'm getting:

standard_init_linux.go:228: exec user process caused: no such file or directory

When I try to call the weather-api from a shell script I get the standard file not found error.

I've tried using an absolute and relative path for the command, copying the file to /usr/local/bin which I think should put it on the PATH so it would be callable from anywhere, changing COPY to ADD.

I'm still new to docker so any help would be greatly appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source