I am trying to learn more about containerization via creating a container image with docker for a demo program that I wrote in go. The image seems to build fine but when I go to run it I get this:
exec /com/zmanhobbies/dnsz/DNSZ: no such file or directory
from my docker run command:
docker run -p 53:8053 zacharyduve/dnsz:latest
I have tested that the executable works fine outside of the container on the same system. Also I have been able to open a sh session with docker run -i zacharyduve/dnsz:latest sh
on the running container and verify that the executable is there as this is the result from my ls command
ls -las /com/zmanhobbies/dnsz/DNSZ
2228 -rwxr-xr-x 1 root root 2277627 Jul 19 13:37 /com/zmanhobbies/dnsz/DNSZ
Interesting is that I get the same not found error from the internal sh session when I try to run the executable that way as well. Through my experimentation I have been able to get a shell script loaded and to run fine but using the same formatting I haven't been able to get my executable to run. From the size of the image it seems like my executable is there. This is the content of my Dockerfile:
FROM alpine
COPY build/DNSZ /com/zmanhobbies/dnsz/DNSZ
CMD [ "/com/zmanhobbies/dnsz/DNSZ" ]
and I am building it along with the executable with this shell script in the same directory as the Dockerfile
export GOOS=linux
go build -o build/DNSZ DNSZ.go
docker build -t zacharyduve/dnsz:latest
I am sure that the problem is between the keyboard and the chair but to me it seems like it all should be working just not sure why I am getting that it doesn't exist when a bunch of things point to it existing.