Open jdavey opened 4 years ago
@jdavey That error seems to be due to system arch differences from compiling the executable on MacOS but trying to run in Linux env.
Interestingly, if I try building the executable on Debian, and try to run the Dockerfile
I get a different error.
$ docker run --rm -it gcs-helper:local
standard_init_linux.go:211: exec user process caused "no such file or directory"
I see the gcs-helper
executable in the /usr/bin
directory, but it does not run.
/ # gcs-helper
/bin/sh: gcs-helper: not found
/ # ls -lah /usr/bin/ | grep gcs
-rwxr-xr-x 1 root root 15.5M Apr 10 20:00 gcs-helper
/ # echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
But, if I run the same executable inside the golang:1.14.2-stretch
image, it works.
It seems like the base alpine
image is missing some shared object file dependencies.
root@3a1137bfd01f:/usr/src/app# ldd gcs-helper
linux-vdso.so.1 (0x00007ffe539f9000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb8dd4f2000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb8dd153000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb8dd70f000)
/usr/bin # ldd ./gcs-helper
/lib64/ld-linux-x86-64.so.2 (0x7f80df921000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f80df921000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f80df921000)
Update: I was able to fix the alpine image by symlinking the musl
library to the location that the linker wants.
mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
musl
bundles shared libraries in a single file including libpthread
, so creating the symlink for /lib/libc.musl-x86_64.so.1
is all that was needed.
I'm trying to build the docker image and am having problems running it:
I'm running on macOS, go version go1.14.2 darwin/amd64, docker 18.09.1