Docker 执行 : ipconfig failing

标签 docker asp.net-core-2.0 .net-core-2.0

当遵循 tutorial 时对于 Docker 和 .NET Core,使用适用于 Linux 容器的 Docker 构建并运行示例运行良好,但使用适用于 Windows 容器的 Docker 构建并运行示例失败并出现奇怪的错误。

cd aspnetapp
docker build -t aspnetapp .
docker run -it --rm --name aspnetcore_sample aspnetapp

然后在第二个cmd/PS中

docker ps
docker exec aspnetcore_sample ipconfig

OCI runtime exec failed: exec failed: container_linux.go:295: starting container process caused "exec: \"ipconfig\": executable file not found in $PATH": unknown

搜索结果为空。

最佳答案

在尝试使用 Visual Studio 2017 的 docker 项目并使用 add docker support that VS17 has built in 后,解决方案变得显而易见。 .

将 docker 支持添加到新的 .NET Core MVC 项目后进行构建:

Done building project "docker-compose.dcproj" -- FAILED.

Volume sharing is not enabled. Enable volume sharing in the Docker CE for Windows Settings.

右键docker任务栏图标-设置,共享驱动器(选择里面有代码的驱动器)

再次运行。

Your Docker server host is configured for 'Linux', however the docker-compose project targets 'Windows'. docker-compose C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets 165

必须右键单击 docker 任务栏“切换到 Windows 容器”,需要安装或更新,并在重新启动后再次选择它。已修复。

关于Docker 执行 : ipconfig failing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47480782/

相关文章:

c# - 此平台不支持 LocalDB

c# - 默认的 Asp.Net Core web 模板带有错误

c# - 如何在 .Net Core 2 项目的 VSTS 构建服务器上编译 Typescript 文件

docker - 如何防止docker搜索docker hub

node.js - 如何在 Docker 中运行两个 Node.js 应用程序和 mysql

angular - Visual Studio 2017 .NET Core 2.1 Angular 上出现 "npm run build -- --prod"错误

c# - JWT 和 Windows 身份验证的 ASP.Net Core 2.0 混合身份验证不接受凭据

azure - 将元数据添加到 Azure 函数中的跟踪

Docker撰写无效的卷目标路径: '.' mount path must be absolute

ubuntu - 安装特定版本的 docker