docker - 无法在 Powershell 命令中创建 DockerFile
问题描述
我无法在 Powershell 中创建 DockerFile。我正在使用的命令是:
FROM mcr.microsoft.com/dotnet/aspnet:3.1
我得到的错误是:
The 'from' keyword is not supported in this version of the language.
您可以清楚地看到我正在从应用程序目录运行命令:“D:\Website\Project\Dockers\App”。
我正在关注官方的微软文档。链接在这里。
我在运行中安装了 dockers 桌面。它在Linux 容器模式下运行。
怎么了,少了点什么?
解决方案
PowerShell 不是 Docker,PowerShell 将无法解析或理解 docker 命令。
如果要从 PowerShell编写dockerfile,请像编写任何其他文本文件一样:
"FROM mcr.microsoft.com/dotnet/aspnet:3.1" |Add-Content .\Dockerfile
推荐阅读
- javascript - 如何从 NodeJS 中的 blob 中获取 WAV 文件
- python - 在给定多个条件的数组中查找一个值
- spring - 在 IntelliJ 中使用 WebTestClient,即使单元测试以正确的结果通过,代码覆盖率也显示为 0%
- azure - Azure 数据工厂复制活动正在将列放在地板上
- ios - 如何在 XCode 11 中更改图像的位置以进行纵向或水平对齐
- python - 单击文件下载 Selenium Python
- python - 为什么bool值在python中一次输入会改变两次?
- python - 匹配不同数据框中的两列并在 python 中显示匹配分数 - 快速
- python - 如何遍历两个熊猫列并创建一个新列
- typescript - 如何键入字典传递样式?