Problem: I am attempting to create and run a Docker container of an Edge Service on a Raspberry Pi using 64 bit Raspbian. Due to other limitations, I am attempting to containerize the program (in Golang) by containerizing the build executable file, rather than building the .go in the Dockerfile. My Dockerfile looks like this
FROM golang:alpine
WORKDIR /build
ADD server .
EXPOSE 50051
CMD ["./server"]
Running the built executable on it's own works correctly, and when creating the Docker Image using the command "sudo docker build -t server:v7 .", the Docker Daemon gives no errors, with the finished image being displayed on the list of Docker Images as if it were correctly working. However, when I try to run the Image, I receive the error "standard_init_linux.go:219: exec user process caused: no such file or directory", rather than the file running.
CodePudding user response:
Do you build on Raspberry or a different machine? If you build on PC, you need to set the build target architecture to match the Raspberry.
CodePudding user response:
The image "golang:alpine" is available for Raspberry, so this should not be the problem.
The error "user process caused: no such file or directory" is then probably related to the file you are trying to execute.
- Make sure the file exists in the directory
- Make sure the file is executable
Maybe change the CMD to "ls -la" to see in the docker logs if the file is there and which attributes it has.