LoginSignup
28
16

More than 3 years have passed since last update.

standard_init_linux.go:211: exec user process caused "no such file or directory" の直し方

Posted at

はじめに

Windows環境でDockerコンテナを起動すると稀に standard_init_linux.go:211: exec user process caused "no such file or directory" というエラーに遭遇する。

ベースイメージにalpineを使っている場合の記事はよく見るが今回の件では別の問題だったので共有。ちなみに、alpineの場合はbashashに変更すれば良いらしい。

(コメント、修正等あったらコメントにて教えていだたきたいです)

解決方法

結論から言うと、以下のファイルの改行コードをCRLFからLFに変更すれば解決する。

  1. Dockerfile
  2. docker-compose.yml
  3. 1,2で呼び出している*.shファイル

どうやら改行コードがWindows標準のCRLFになっているのが原因らしい。

gitコマンドの設定

上記の修正で問題は解決するが、再発防止のために確認すべきポイントがあるので紹介する。

Windowsでgitコマンドを使っていると、git clone等のコマンドを叩いた時に自動でLFCRLFに自動で変換してくれる場合がある。この場合タイトルのエラーが出るため、自動変換をオフにしたい。

この機能をオフにするには以下のコマンドを叩けば良い。

git config --global core.autocrlf input

autocrlfの細かい挙動については参考3の記事を参照されたい。

参考

  1. Dockerでalpineイメージ使用時に発生したstandard_init_linux.go:211: exec user process caused "no such file or directory" を解決
  2. Windows Docker Error - standard_init_linux.go:211: exec user process caused "no such file or directory" #9
  3. 気をつけて!Git for Windowsにおける改行コード
28
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
16