運行docker容器異常中止,使用docker logs CONTAINER_ID查看異常信息如下:standard_init_linux.go:207: exec user process caused "no such file or directory"
這是dos字符與unix字符的問題,我使用的windows 環境里 visual studio 編寫的 shell 腳本 默認是以DOS文本格式來創建的,所以才導致這樣的問題。
解決方法:
使用 Notepad++.執行一個批量的替換 :
- Menu: Search -> Find in Files...
- Directory = the directory you want to be converted to Unix format, recursively. E.g., C:\MyDir
- Find what = \r\n
- Replace with = \n
- Search Mode = Extended
- Press "Replace in Files"