cannot run jfrog executable from inside alpine linux container

LetsPlayYahtzee picture LetsPlayYahtzee · Apr 4, 2017 · Viewed 7k times · Source

I am using an alpine linux container and specifically python:3.4-alpine and openjdk:8-jdk-alpine. When I try to execute any script or executable that I have placed in the executable I get Not Found error.

For example. When in the python:3.4-alpine container I want to install jfrog I follow the command here (after I install curl via apk). This command downloads a shell script and pipes it to sh which downloads and creates a jfrog executable with the correct permissions. When I am trying to run this executable I am getting

bin/sh: ./jfrog: not found

update

I discovered that the root user is using bin/ash by default, which I have no idea what it is. So I invoked bin/sh jfrog manually and I get

/ # bin/sh jfrog jfrog: line 1: ELF: not found jfrog: line 1: syntax error: unterminated quoted string

Any idea what I am doing wrong? I suspect that it has to do with only root user existing in the container.

Answer

michael_bitard picture michael_bitard · Apr 4, 2017

I'm not sure but the jfrog executable is dynamically linked, and with ldd jfrog you get :

ldd jfrog
    /lib64/ld-linux-x86-64.so.2 (0x55ffb4c8d000)
    libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x55ffb4c8d000)
    libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x55ffb4c8d000)

As you can see you have libc dependencies, and alpine come with musl. You can try to add apk add libc6-compat but I'm not sure it will work