skip to Main Content

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.

Some additional notes as per the comments: All of the programs were written in Ubuntu, they were built to an executable on Raspberry Pi, and the Dockerfile was also written on the the Raspberry Pi. When using the command "sudo docker run -it -d : sh", the image will run, and when using the command "sudo docker exec -it sh", terminal will enter the shell. Attempts to run the program from within the shell similarly fail, yielding the error "sh: error not found"
ldd yields the following results:

/lib/ld-linux-aarch64.so.1 (0x7f8731f000)
libpthread.so.0 => /lib/ld-linux-aarch64.so.1 (0x7f8731f000)
libc.so.6 => /lib/ld-linux-aarch64.so.1 (0x7f8731f000)

And there seems to be no problem with Alpine or with $PATH

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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.

    1. Make sure the file exists in the directory
    2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search