gpt4 book ai didi

docker - Docker exec:ipconfig失败

转载 作者:行者123 更新时间:2023-12-02 18:11:30 25 4
gpt4 key购买 nike

在针对Docker和.NET Core使用tutorial时,使用Docker for Linux容器构建和运行示例运行正常,但是使用Docker for Windows容器构建和运行示例失败,并出现奇怪的错误。

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 - Docker exec:ipconfig失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47480782/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com