LM10
LM10

Reputation: 1199

Alpine Image standard_init_linux.go:207: exec user process caused "no such file or directory"

I am trying to run an alpine based container which will run a hello world C++ program on starting. However, I'm getting a standard_init_linux.go:207: exec user process caused "no such file or directory" error on running the container.

I did an ls -al into the container to check if the file exists with the correct permissions. The executable(named test) exists in the root directory with -rwxrwxr-x permissions.

This is my Dockerfile.

FROM alpine:latest
ADD test /
ENTRYPOINT ["/test"]

Can someone help me in identifying what the issue is? Thanks !

Edit : I compiled my .cpp file on Ubuntu 18.04 to generate the executable. g++ -o test test.cpp

test.cpp :

#include <iostream>

using namespace std;

int main()
{
   cout<<"Hello World"<<endl;
   return 0;
}

Upvotes: 1

Views: 980

Answers (1)

atline
atline

Reputation: 31574

Most probably because you build out test binary on non-alpine operation system, and then try to run it in alpine.

E.g. If you check the dependency of your binary, you may could find next(this could be different according to your system):

$ ldd test
linux-vdso.so.1
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
/lib64/ld-linux-x86-64.so.2

But in alpine, it do not use glibc, it use musl libc.

So suggest you directly build it out in alpine, or for simple application, use next:

g++ -o test -static test.cpp

Upvotes: 4

Related Questions