Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

396
Views
Docker: standard_init_linux.go:211: exec user process caused "no such file or directory"

I am trying to create a base image following the instructions given in official docker webpage(https://docs.docker.com/samples/library/scratch/)

    docker --version
    Docker version 18.09.6, build 481bc77

    OS Details:
    NAME="Ubuntu"
    VERSION="18.04.2 LTS (Bionic Beaver)"

DockerFile:

    FROM scratch
    COPY hello /
    CMD ["/hello"]

hello.c

    #include <stdio.h>
        int main()
        {
           // printf() displays the string inside quotation
           printf("Hello, World!");
           return 0;
        }

I am able to compile the C program and execute locally

I am able to build the image using the dockerfile but when I try to run the container, I get the below error:

    # docker run -i hello
        standard_init_linux.go:211: exec user process caused "no such file or directory" 
    #

I expect the container to run successfully and print "Hello World" on console. most of the answers provided are asking to change EOL which is not applicable as we are already on Linux and not trying to run script.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

I guess you get this error because you built out a dynamic linked binary like next:

$ gcc -o hello hello.c
$ ldd hello
    linux-vdso.so.1 (0x00007ffe3b1ec000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7fe1fc7000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f7fe25ba000)

The scratch is really basic which do not have so many so for your binary to dynamic link. So, you need to build out a static link binary, like:

$ gcc -o hello -static hello.c
$ ldd hello
    not a dynamic executable

Then, it will be work like next:

$ docker build -t hello .
Sending build context to Docker daemon  848.4kB
Step 1/3 : FROM scratch
 --->
Step 2/3 : COPY hello /
 ---> 9d594b34f774
Step 3/3 : CMD ["/hello"]
 ---> Using cache
 ---> 2f1bad3099d3
Successfully built 2f1bad3099d3
Successfully tagged hello:latest
$ docker run -i hello
Hello, World!

And, if you do not use scratch image which have more .so in the system, then you no need to build out static binary.

over 4 years ago · Santiago Trujillo Report

0

It seems this happens when the scripts have wrong line feeds. Based on git settings you might have DOS CRLF instead of UNIX LF. Setting the line feeds helped me fix the issue.

How to change line-ending settings

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!