我们正在尝试在Python-flask
机器上构建Windows 10
映像,这是Dockerfile的一部分。
RUN chmod +x /var/www/projectname/entrypoint.local.sh
尝试使用docker文件构建映像时出现错误
这是错误:
chmod : The term 'chmod' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:76
+ ... nce = 'Stop'; $ProgressPreference = 'SilentlyContinue'; chmod +x /var ...
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (chmod:String) [], ParentContain sErrorRecordException
+ FullyQualifiedErrorId : CommandNotFoundException ERROR: Service 'controller_service' failed to build: The command 'powershell
-Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; chmod +x /var/www/projectname/entry point.local.sh' returned a non-zero code: 1
正在考虑在Dockerfile
中将 chmod 作为Windows
命令。
编辑1:
我正在尝试使用以下命令将图像构建为docker-compose
的一部分:
docker-compose up --build
。
我正在Terminal
中Pycharm
的{{1}}中运行以上命令。
请提出解决此问题的建议。谢谢!
答案 0 :(得分:0)
当您实际配置Linux
来构建Docker desktop
时,您似乎正在尝试构建Windows images
图像。
这就是为什么您可能会得到错误chmod
命令的原因,该命令特定于Linux
,在Windows
上不起作用。
您可以按照以下步骤解决。
Switch to Linux containers
的选项。您应该很好。