[英]Dockerfile script working in native Ubuntu but not in Windows or WSL
In my Dockerfile I have the next RUN script:在我的 Dockerfile 中,我有下一个 RUN 脚本:
RUN set -ex; \
echo "Downloading plugins"; \
cd /tmp/plugins; \
for f in `cat plugins.list`; do\
curl -O -fSL $f; \
done;
When I build the image from native Ubuntu it works flawlessly, but when I do it from Powershell or Ubuntu in Windows Subsystem for Linux it always gives me the same error: When I build the image from native Ubuntu it works flawlessly, but when I do it from Powershell or Ubuntu in Windows Subsystem for Linux it always gives me the same error:
---> Running in 095faf998ee4
+ echo 'Downloading plugins'
+ cd /tmp/plugins
Downloading plugins
+ cat plugins.list
' curl -O -fS 'https://downloads.wordpress.org/plugin/ninja-forms.3.4.19.zip
curl: (3) URL using bad/illegal format or missing URL
If I run the curl command directly from bash it works flawlessly too, but if I run that part of the script it fails too.如果我直接从 bash 运行 curl 命令,它也可以完美运行,但是如果我运行脚本的那一部分,它也会失败。
As @cbley commented, the issue was in the EOL character, since on default sublime text on windows has EOL like windows, it was giving errors to the script.正如@cbley 评论的那样,问题出在 EOL 字符中,因为 windows 上的默认崇高文本具有像 windows 这样的 EOL,它给脚本带来了错误。
Either replacing with tr -d '\r' < plugins.list > plugins.list_new
as @cbley commented on my question or setting sublime text's default EOL as "Unix" by adding "default_line_ending": "unix",
to the sublime preferences did the trick.要么用tr -d '\r' < plugins.list > plugins.list_new
替换 @cbley 评论我的问题,要么通过在 sublime 偏好中添加"default_line_ending": "unix",
将 sublime text 的默认 EOL 设置为 "Unix"诀窍。
Thanks @cbley!谢谢@cbley!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.