且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

尝试构建Docker容器,找不到start.sh

更新时间:2023-11-20 09:45:22

结果证明我的文件没有任何问题。我在PC上创建了一个新目录,创建了新文件,并复制了start.sh和Dockerfile以及我的应用程序的内容。错误消失了。这一定是一个严重的错误,我的朋友在我的PC上也能正常工作的其他文件也遇到了同样的错误。

Turns out there wasn't anything wrong with my files. I created a new directory on my pc, created new files and copied the contents of the start.sh and Dockerfile and my app there. The error was gone. This has to be some serious bug, my friend just got the same error with other files that work on my pc as well.

在Docker和Windows 10上可能存在一些问题。

Maybe some issue with Docker and Windows 10.

编辑:无法为我的朋友和我再次遇到相同的问题。

couldn't fix it for my friend and I run into the same issue again. Someone an idea how to fix?

解决方案:这是与在Windows下创建且符合Linux需求的start.sh不兼容的解决方案。要解决此问题,请在复制start.sh之后将其添加到dockerfile中。

SOLUTION: It is a incompatibility of the start.sh which is created under windows and with the one linux needs. To solve this, add this to the dockerfile, after you copied the start.sh:


RUN dos2unix /start.sh

RUN dos2unix /start.sh

如果未安装dos2unix,则必须先安装:

If dos2unix is not installed, you have to install it first:


运行apt-get install dos2unix

RUN apt-get install dos2unix