dockerfile安装php遇到/bin/sh: docker-php-source: not found问题

/bin/sh: docker-php-source: not found进入当前容器,发现docker-php-source文件存在但是也无法执行~
发现docker-php-source文件的每行结尾都会有一个^M符号,这是因为 DOS下的编辑器和Linux编辑器对文件行末的回车符处理不一致,
对于回车符的定义: 


windows:0D0A


unix\linux: 0A


MAC: 0D


解决:

git config -l 看看 core.autocrlf 的设置是不是 true

git 客户端应该都设置为 false,当然,服务器上的 git 客户端需要保持 true

代码编辑器换行默认符号都应该设置为 unix ,以下是常用编辑器的默认设置方法

    • Sublime -> Preferences -> Settings -> User -> "default_line_ending": "unix",
    • Notepad++ -> 设置(Settings) -> 首选项(Preferences) -> 新建(New Document) -> Unix(LF)
    • PhpStorm -> File -> Settings -> Editor -> Code Style -> Line separator -> Unix and OS X (\n)