Root Cause and Solutions for standard_init_linux.go:190 Error in Docker

Nov 22, 2025 · Programming · 17 views · 7.8

Keywords: Docker | Line Endings | CRLF to LF | standard_init_linux.go | Container Startup Error

Abstract: This article provides an in-depth analysis of the standard_init_linux.go:190: exec user process caused "no such file or directory" error in Docker containers. Through practical case studies, it demonstrates the incompatibility between CRLF line endings in Windows and LF in Linux environments, detailing EOL conversion methods using Notepad++ and VSCode. The article also covers key knowledge points including shell interpreter selection and ENTRYPOINT format configuration, offering comprehensive troubleshooting workflows and multiple solutions to help developers completely resolve such container startup issues.

Error Phenomenon and Background Analysis

When running Docker images on Windows 10 environment, users encounter the standard_init_linux.go:190: exec user process caused "no such file or directory" error. This error typically occurs during container startup when Docker attempts to execute the executable file specified by ENTRYPOINT or CMD, but the system cannot locate the corresponding file or properly parse the file format.

Core Issue: Line Ending Incompatibility

According to the best answer analysis, the primary issue lies in the line ending differences between Windows and Linux systems. Windows uses CRLF (Carriage Return + Line Feed, i.e., \r\n) as line endings, while Linux systems use LF (Line Feed, i.e., \n). When shell scripts are edited in Windows environment without proper format conversion, the Linux environment within Docker containers cannot correctly recognize the script files.

Here is a typical error scenario: users create run.sh script on Windows system, where the script content is correct but the container fails to start due to CRLF line endings.

Solution: EOL Conversion

Using Notepad++ for Conversion

In Notepad++, conversion can be completed through the following steps:

  1. Open the target script file
  2. Click the "Edit" menu
  3. Select "EOL Conversion"
  4. Choose "Convert to LF (Unix)"

After conversion, save the file and rebuild the Docker image to resolve the issue.

Using VSCode for Conversion

For VSCode users, the conversion process is more straightforward:

  1. Open the target script file
  2. Check the status bar at the bottom right corner
  3. Click the button showing "CRLF"
  4. Select "LF" from the pop-up options

This method quickly completes format conversion, ensuring scripts execute correctly in Linux environment.

Additional Solutions

Shell Interpreter Compatibility

Referring to other answers, shell interpreter selection is also an important factor. Some base images (such as Alpine Linux) do not include bash by default, only providing /bin/sh. If a script specifies #!/bin/bash but bash doesn't exist in the image, the same "no such file or directory" error will occur.

Solutions include:

ENTRYPOINT Format Configuration

ENTRYPOINT format configuration is also crucial. Docker supports two forms of ENTRYPOINT:

The exec form is recommended as it ensures proper process signal handling and resource cleanup. In some cases, changing ENTRYPOINT ["/run.sh"] to ENTRYPOINT ["sh", "/run.sh"] can resolve the issue, because the former relies on script executable permissions and correct shebang, while the latter explicitly specifies the shell interpreter.

In-depth Technical Analysis

The standard_init_linux.go:190 error originates from Docker's container initialization process. When Docker starts a container, it calls relevant functions in standard_init_linux.go to set up the container environment and execute user-specified processes. The error message indicates that the execve system call failed, with specific reasons including:

In Windows environment, CRLF line endings cause script files to be recognized as binary files containing invalid characters in Linux environment, thus triggering the "no such file or directory" error.

Best Practice Recommendations

To avoid such issues, the following best practices are recommended:

  1. Unified Development Environment: Standardize using LF as line ending standard in team development
  2. Editor Configuration: Set default line ending to LF in code editors
  3. Version Control Configuration: Configure core.autocrlf as input or false in Git
  4. Container Validation: Verify script executability by entering container via docker run -it <image> /bin/sh before building image
  5. Use Multi-stage Builds: Ensure final stage uses correct file format in multi-stage builds

Troubleshooting Workflow

When encountering standard_init_linux.go:190 error, follow this troubleshooting workflow:

  1. Check file existence: Use ls -la in container to confirm target file exists
  2. Verify file permissions: Ensure script file has execute permissions (chmod +x)
  3. Check line endings: Use cat -A or file command to check file format
  4. Validate shebang: Confirm interpreter specified in script first line exists and has correct path
  5. Test script execution: Manually execute script in container to verify functionality
  6. Check ENTRYPOINT format: Ensure correct ENTRYPOINT format is used

Through systematic troubleshooting, such container startup issues can be quickly identified and resolved.

Copyright Notice: All rights in this article are reserved by the operators of DevGex. Reasonable sharing and citation are welcome; any reproduction, excerpting, or re-publication without prior permission is prohibited.