0

I have an executable written in Golang, it starts and runs fine when started from the Linux-prompt. As you can see, the executable needs an XML file when started. But when started inside a Docker environment, I get error message:

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

Let me tell you what I tried. First, this is my Dockerfile:

FROM alpine:latest
MAINTAINER Bert Verhees "xxxxx"
ADD archibold_ucum_service /archibold_ucum_service
ADD data/ucum-essence.xml /data/ucum-essence.xml
ENTRYPOINT ["/archibold_ucum_service", "-ucumfile=/data/ucum-essence.xml"]

I build it in this way:

docker build -t=ucum_micro_service .

Then I start it in this way

docker run --name=ucum_micro_service -i -t ucum_micro_service /bin/sh

When I do this, I get the error-message, as displayed above. Then I tried commenting out the ENTRYPOINT line, and then it builds OKAY and it starts the linux prompt, so I can query what is inside. The executable is in it, and the data-file also. And the executable also has the right attributes (it is executable inside the docker-container)

Then I try to start the executable from the linux-prompt, inside the started container, and then I get again a message that the file is not found:

/ # ./archibold_ucum_service
/bin/sh: ./archibold_ucum_service: not found

For completeness, here is partly the directory-structure in the container:

/ # ls -l
total 17484
-rwxrwxr-x    1 root     root      17845706 Aug  3 13:21 archibold_ucum_service
drwxr-xr-x    2 root     root          4096 Jul  5 14:47 bin
drwxr-xr-x    2 root     root          4096 Aug  3 14:29 data
drwxr-xr-x    5 root     root           360 Aug  4 20:27 dev
drwxr-xr-x   15 root     root          4096 Aug  4 20:27 etc
drwxr-xr-x    2 root     root          4096 Jul  5 14:47 home
drwxr-xr-x    5 root     root    ........
.......

So, what can be the problem. I am trying to solve this for over a day now. Thanks for support.

Bert Verhees
  • 1,057
  • 3
  • 14
  • 25
  • 1
    in the container's shell, try `ldd /archibold_ucum_service`. It should give you a list of dependencies. Maybe some of those are present on the build host but absent in the (minimal) alpine linux container. – Paul Aug 04 '18 at 20:42
  • That must be the problem. I checked: / # ldd archibold_ucum_service /lib64/ld-linux-x86-64.so.2 (0x7fbddfacf000) libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fbddfacf000) libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fbddfacf000) I think those libraries are indeed not there. Thanks. I am not in the position to work further on to this. But it is a good pointer to a solution. I let you know monday – Bert Verhees Aug 04 '18 at 20:48
  • 1
    There are other docker images that include go.... try searching for them on dockerhub and using that in place of plain alpine... that's better than install the missing libs yourself. – Paul Aug 04 '18 at 20:50
  • Thanks, I will investigate this ;-) Have a nice weekend – Bert Verhees Aug 04 '18 at 20:51
  • 1
    Use `debian:stretch`, should work fine. – johnharris85 Aug 04 '18 at 22:19
  • debian:stretch works fine. Thanks – Bert Verhees Aug 06 '18 at 08:17

0 Answers0