我正在使用VS2019,并且在手动创建的坞容器中以及通过visual生成的存根中部署了一个完美的服务。VS的发布实现工作正常,但是当我从VS的调试模式运行容器时,由于缺少它的依赖项之一,我的服务会抛出异常。
Dockerfile
RUN apt-get update && apt-get install handbrake-cli -y //This is the only line which has been added to the VS2019 dockerfile stub.
ENTRYPOINT ["dotnet", "myapp.dll"]如果我启动docker /CLI,会观察调试下的行为。
# apt-get install handbrake-cli
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package handbrake-cli
# apt-get update && apt-get install handbrake-cli
...
Reading state information... Done
The following additional packages will be installed:
...
# HandBrakeCLI
[14:11:51] hb_init: starting libhb thread
[14:11:51] thread 7eff9c606700 started ("libhb")
Missing input device. Run HandBrakeCLI --help for syntax.
HandBrake has exited.
#可以清楚地看到,我的Dockerfile似乎没有应用在调试模式下更新和安装手制动器-cli的行。我已经尝试过拆分更新并将其安装到单独的运行中,但是同样的行为仍然存在。此时,我对自己做错了什么感到有点困惑,因为发行版构建没有受到这个问题的影响。
发布于 2020-10-11 18:06:44
C#争端中的Cisien:
我猜VS正在跳过最后一个阶段,用自己的
来附加调试器
解决方案是将安装移至第二行,以便:
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim AS base
RUN apt-get update && apt-get install -y handbrake-cli && apt-get clean类似地,建议使用apt-获取清洁,以减少图像大小。
非常感谢Cisien的及时和准确的答复!
https://stackoverflow.com/questions/64305100
复制相似问题