Blog Supporters Resume
Part time open-sourcerer, Linux enthusiast, Rust fanatic

Cannot run executable in Alpine on Docker

October 12, 2021


When trying to run a executable on alpine linux, a error message similar to the one below is being returned:

$ ./my-script
sh: ./my-script not found


Quoted from valiano on StackOverflow:

Most of the world Linux software is linked against glibc, the GNU libc library (libc provides the standard C library and POSIX API). Most Linux distributions are based on glibc. OTOH, Alpine Linux is based on the musl libc library, which is a minimal implementation and strictly POSIX compliant. Executables built on glibc distributions depend on /lib/x86_64-linux-gnu/libc.so.6, for example, which is not available on Alpine (unless, they are statically linked).

Simply put, Alpine can’t run programs compiled with glibc, due to the fact that it ships with musl by default, the easier and fastest solution by far, is to install gcompat, the go-to compability layer for Alpine users:

apk add gcompat

After that you run your binaries as normal