Tag: .net

Docker退出,状态码为139

我有一个.Net核心应用程序在泊坞窗图像上运行它。 我在命令行input: docker run -d –net=bridge -it –name=testapp -v /var/test/:/var/test microsoft/aspnetcore-build /bin/bash -c "dotnet /var/test/test.dll" 它被创build,但它正在退出状态代码139.可能是什么问题。

我应该使用docker的用户机密或环境variables

当使用docker与asp.net核心进行开发时,我应该使用用户机密还是环境variables? 我正在使用Visual Studio 2017在添加一个使用microsoft / aspnetcore:1.1的项目时创build的默认docker文件,我相信这是一个linux映像。 如何在Docker中设置用户密码/环境variables,以便在启动时设置它们,但不包含在源代码中?

远程debugging.NET核心Linux Docker容器 – “当前源与内置到.dll中的版本不同”

docker .NET Core 1.1 Visual Studio 2017 .NET核心debugging器(clrdbg) 我收到以下错误: "The breakpoint will not currently be hit. A copy of TokenController.cs was found in TSL.Security.Service.dll, but the current source code is different from the version built into the TSL.Security.Service.dll." 我将一步一步地了解如何构build我的.NET核心Docker镜像,并从此镜像运行Container实例,然后使用Visual Studio 2017连接远程, 我的Dockerfile.debug位于我的问题的底部 : 在我的docker主机上cd ~/repos/api.security //一个git仓库 git pull //从git中为.NET Core项目提取最新的代码 dotnet restore dotnet publish没有其他参数与.pdbs发布 docker […]

.NET Core 1.1,Docker Build遇到无法用csprojfind'project.json'

我从.NET Core 1.0升级了一个应用程序到1.1。 在这个过程中,dotnet build命令开始使用.csproj项目文件,所以我摆脱了旧的project.json文件。 一切正常,直到我尝试运行docker build命令: dockerbuild设-t样本。 当它在Dockerfile中碰到RUN [“dotnet”,“build”]命令时,我得到一个错误: Sending build context to Docker daemon 3.418 MB Step 1 : FROM microsoft/dotnet:latest —> 3693707d4f7f Step 2 : COPY . /app —> 771e2b035ea1 Removing intermediate container c271f962518e Step 3 : WORKDIR /app —> Running in 6a07c60bab1d —> e819bc2a9e25 Removing intermediate container 6a07c60bab1d Step 4 : […]

Webpack,asp.net核心,docker:用dotnetdebugging或发布构buildwebpack

我有一个asp.net核心应用程序,类似于aspnetcore-spa提供的。 Webpack被设置为–env.prod和–env.dev并通过JavaScriptServices集成。 从Visual Studio 2015构build和运行应用程序似乎工作正常*。 Debug Development环境在Kestrel上运行良好 – webpack中间件(重新)构build客户端应用程序和热门模块replace效果良好(虽然速度有点慢 – 很可能是由于需要复制硬编码的引用资源)。 *但是,供应商捆绑软件从不重build,也不会运行–env.prod webpack构build。 我认为这一切都可以(甚至在这个例子中)只是因为一个版本的文件被提交到版本库。 运行dotnet run或dotnet build是不够的,因为这不会触摸webpack。 我可以在package.json中为此提供一些脚本,我不知道如何(或者如果)可以将它embeddedVisual Studio的构build中 – 另外,我直接使用npm而不是dotnet来感觉有点脏。 这整个问题也与我构build可debuggingDocker镜像的问题有关。 我想我可以在容器中运行webpack并复制所有的源代码 – 但是这仍然留下了一个问题: 我如何将webpack版本集成到Visual Studio(甚至更好, dotnet )?

.Net – 将日志从Web应用程序推送到运行Fluentd的Docker容器

我想将.net Web应用程序日志推送到在Docker容器上运行的stream畅图像。 为此,我安装了Docker Toolbox,并在Docker上运行了stream畅的图像。 首先,我尝试通过telnet发送文本到容器,容器收到这些消息并打印在命令行上。 为了从Web应用程序发送日志,我尝试了这里描述的方法(使用Nlog.Targets.Fluentd包) https://groups.google.com/d/msg/fluentd/bjf6V0E8oAQ/cTBlxXMbzkAJ 。 主机,端口,标签等连接细节与我在telnet中使用的相同,但无法将日志发送到容器。 Docker镜像库名称是“stream利的”,标签名称是“最新的”。 这是我如何在docker上运行stream畅的图像: docker run -it ip 47001:24224 fluent:latest 这就是我如何使用Nlog.Targets.Fluentd方法: using (var fluentdTarget = new NLog.Targets.Fluentd()) { fluentdTarget.Layout = new NLog.Layouts.SimpleLayout("${longdate}|${level}|${callsite}|${logger}|${message}"); fluentdTarget.Host = "192.168.99.100"; // IP of the docker fluentdTarget.Port = 47001; // mapped port number on host fluentdTarget.Tag = "fluent:latest"; config.AddTarget("fluentd", fluentdTarget); config.LoggingRules.Add(new NLog.Config.LoggingRule("demo", LogLevel.Debug, fluentdTarget)); […]

部署.NET Core 1.1应用程序到Docker – 无法parsingCoreCLRpath

我们正在尝试将我们的.NET Core应用程序部署到docker。 假设我们的项目基地位于/source. 当我们在/source运行dotnet restore dotnet build和dotnet run ,一切正常。 但是当我们触发dotnet publish -c Release -o publish ,进入publish文件夹,并尝试dotnet OurAppName.dll (直接从DLL运行应用程序),这个错误是抛出: Could not resolve CoreCLR path. For more details, enable tracing by setting COREHOST_TRACE environment variable to 1 摘要:在dotnet run dotnet OurAppName.dll容器中的dotnet核心应用程序时, dotnet run在source文件夹中正常工作, dotnet OurAppName.dll在publish文件夹中崩溃。 可能是什么问题? 我们已经在我们的DockerFile尝试了latest和1.1-sdk-projectjson标签。

.Net Core Clrdebugging器VSDBG在Windows Docker容器中连接到远程进程时暂停应用程序

我有一个.net核心应用程序运行在一个Windowsdocker容器,我想附加VS代码。 当我连接到远程进程,似乎进程冻结,如果我断开debugging器,容器closures没有任何错误。 launch.json { "name": ".NET Core Remote Attach", "type": "coreclr", "request": "attach", "pipeTransport": { "pipeProgram": "powershell", "pipeArgs": ["docker exec -i –privileged amazing_johnson" ], "pipeCwd": "${workspaceRoot}", "debuggerPath": "c:\\coreclr-debug\\vsdbg.exe" }, "processId": "1736" }, debugging输出控制台中的结果: Starting: "powershell" "docker exec -i –privileged amazing_johnson" "c:\coreclr-debug\vsdbg.exe –interpreter=vscode" 将debugging器附加到远程进程后,当我尝试访问该站点时,它只是挂起,VSCode列出线程并在terminal中显示一些JSON,但没有任何反应。 断开连接会closures容器。 为什么发生这种情况?

添加应用程序参数以在Docker中运行.NET控制台应用程序

在我的docker文件中,我有这样的: FROM microsoft/dotnet:2.0-runtime ARG source WORKDIR /app COPY ${source:-obj/Docker/publish} . ENTRYPOINT ["dotnet", "app.dll"] 我需要将应用程序parameter passing给应用程序,让我们说 – –argument ,以便应用程序可以在容器内运行。 所以,我知道我可以在本地运行应用程序 dotnet run — –argument 但我坚持试图将–argument添加到Dockerfile(或任何地方,我不知道)。 我尝试在CMD ["–argument"]添加CMD ["–argument"] , CMD ["–", "–argument"] ,但没有成功。 是否有可能做到这一点?

如何在.NET核心可执行文件中监听来自Docker的信号?

我有一个用.Net Core编写的控制台应用程序。 我将在Docker容器中运行这个。 我想优雅地停止一个docker stop命令时的进程,而不是让这个进程在做某事的时候被杀死。 有没有一种方法可以在控制台应用程序中侦听此信号? 在容器之前,我只想让控制台应用程序监听在控制台窗口中键入的内容。 如果有一种方法可以让Docker通过标准input发送消息,那么我可以使用这个方法,但是我对Docker还不够了解,但是知道什么是可能的。