Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to run in a sidecar container fails with "Permission denied" #7016

Closed
mu88 opened this issue Jul 21, 2024 · 8 comments
Closed

Trying to run in a sidecar container fails with "Permission denied" #7016

mu88 opened this issue Jul 21, 2024 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@mu88
Copy link

mu88 commented Jul 21, 2024

Description

I want to get started with dotnet monitor and since I'm using Docker Compose instead of K8s, I created the following docker-compose.yml based on the dotnet monitor K8s docs:

services:
  exampleapp:
    image: mcr.microsoft.com/dotnet/samples:aspnetapp
    user: app
    volumes:
      - diagvol:/diag
    environment:
      - DOTNET_DiagnosticPorts=/diag/dotnet-monitor.sock
  dotnet-monitor:
    image: mcr.microsoft.com/dotnet/monitor:8
    volumes:
      - diagvol:/diag
    command: ["collect", "--no-auth"]
    environment:
      - DOTNETMONITOR_DiagnosticPort__ConnectionMode=Listen
      - DOTNETMONITOR_Storage__DefaultSharedPath=/diag
      - DOTNETMONITOR_Urls=http://localhost:52323
      - DOTNETMONITOR_Metrics__Endpoints=http://+:52325

volumes:
  diagvol:

When starting the stack via docker compose up, it fails with dotnet-monitor-1 | Unhandled exception: System.Net.Sockets.SocketException (13): Permission denied.

Logs
dotnet-monitor-1  | {"Timestamp":"2024-07-21T12:25:21.1489363Z","EventId":60,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.Startup","Message":"Tell us about your experience with dotnet monitor: https://aka.ms/dotnet-monitor-survey","State":{"Message":"Tell us about your experience with dotnet monitor: https://aka.ms/dotnet-monitor-survey","link":"https://aka.ms/dotnet-monitor-survey","{OriginalFormat}":"Tell us about your experience with dotnet monitor: {link}"},"Scopes":[]}
dotnet-monitor-1  | {"Timestamp":"2024-07-21T12:25:21.1678369Z","EventId":77,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.Startup","Message":"Connection mode: Listen at \u0027/diag/dotnet-monitor.sock\u0027","State":{"Message":"Connection mode: Listen at \u0027/diag/dotnet-monitor.sock\u0027","path":"/diag/dotnet-monitor.sock","{OriginalFormat}":"Connection mode: Listen at \u0027{path}\u0027"},"Scopes":[]}
dotnet-monitor-1  | {"Timestamp":"2024-07-21T12:25:21.1735368Z","EventId":13,"LogLevel":"Warning","Category":"Microsoft.Diagnostics.Tools.Monitor.Startup","Message":"WARNING: Authentication has been disabled. This can pose a security risk and is not intended for production environments.","State":{"Message":"WARNING: Authentication has been disabled. This can pose a security risk and is not intended for production environments.","{OriginalFormat}":"WARNING: Authentication has been disabled. This can pose a security risk and is not intended for production environments."},"Scopes":[]}
dotnet-monitor-1  | {"Timestamp":"2024-07-21T12:25:21.5483490Z","EventId":14,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://localhost:52323","State":{"Message":"Now listening on: http://localhost:52323","address":"http://localhost:52323","{OriginalFormat}":"Now listening on: {address}"},"Scopes":[]}
dotnet-monitor-1  | {"Timestamp":"2024-07-21T12:25:21.5487628Z","EventId":14,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://[::]:52325","State":{"Message":"Now listening on: http://[::]:52325","address":"http://[::]:52325","{OriginalFormat}":"Now listening on: {address}"},"Scopes":[]}
dotnet-monitor-1  | {"Timestamp":"2024-07-21T12:25:21.6122573Z","EventId":11,"LogLevel":"Error","Category":"Microsoft.Extensions.Hosting.Internal.Host","Message":"Hosting failed to start","Exception":"System.Net.Sockets.SocketException (13): Permission denied\n   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)\n   at System.Net.Sockets.Socket.Bind(EndPoint localEP)\n   at Microsoft.Diagnostics.NETCore.Client.IpcUnixDomainSocket.Bind(IpcUnixDomainSocketEndPoint localEP)\n   at Microsoft.Diagnostics.NETCore.Client.IpcUnixDomainSocketServerTransport.CreateNewSocketServer()\n   at Microsoft.Diagnostics.NETCore.Client.IpcUnixDomainSocketServerTransport..ctor(String path, Int32 backlog, IIpcServerTransportCallbackInternal transportCallback)\n   at Microsoft.Diagnostics.NETCore.Client.IpcServerTransport.Create(String address, Int32 maxConnections, Kind kind, IIpcServerTransportCallbackInternal transportCallback)\n   at Microsoft.Diagnostics.NETCore.Client.ReversedDiagnosticsServer.Start(Int32 maxConnections)\n   at Microsoft.Diagnostics.Tools.Monitor.ServerEndpointInfoSource.ExecuteAsync(CancellationToken stoppingToken)\n   at Microsoft.Diagnostics.Tools.Monitor.ServerEndpointInfoSource.ExecuteAsync(CancellationToken stoppingToken)\n   at Microsoft.Extensions.Hosting.Internal.Host.\u003CStartAsync\u003Eb__15_1(IHostedService service, CancellationToken token)\n   at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable\u00601 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List\u00601 exceptions, Func\u00603 operation)","State":{"Message":"Hosting failed to start","{OriginalFormat}":"Hosting failed to start"},"Scopes":[]}
dotnet-monitor-1  | Unhandled exception: System.Net.Sockets.SocketException (13): Permission denied
dotnet-monitor-1  |    at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
dotnet-monitor-1  |    at System.Net.Sockets.Socket.Bind(EndPoint localEP)
dotnet-monitor-1  |    at Microsoft.Diagnostics.NETCore.Client.IpcUnixDomainSocket.Bind(IpcUnixDomainSocketEndPoint localEP)
dotnet-monitor-1  |    at Microsoft.Diagnostics.NETCore.Client.IpcUnixDomainSocketServerTransport.CreateNewSocketServer()
dotnet-monitor-1  |    at Microsoft.Diagnostics.NETCore.Client.IpcUnixDomainSocketServerTransport..ctor(String path, Int32 backlog, IIpcServerTransportCallbackInternal transportCallback)
dotnet-monitor-1  |    at Microsoft.Diagnostics.NETCore.Client.IpcServerTransport.Create(String address, Int32 maxConnections, Kind kind, IIpcServerTransportCallbackInternal transportCallback)
dotnet-monitor-1  |    at Microsoft.Diagnostics.NETCore.Client.ReversedDiagnosticsServer.Start(Int32 maxConnections)
dotnet-monitor-1  |    at Microsoft.Diagnostics.Tools.Monitor.ServerEndpointInfoSource.ExecuteAsync(CancellationToken stoppingToken)
dotnet-monitor-1  |    at Microsoft.Diagnostics.Tools.Monitor.ServerEndpointInfoSource.ExecuteAsync(CancellationToken stoppingToken)
dotnet-monitor-1  |    at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
dotnet-monitor-1  |    at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
dotnet-monitor-1  |    at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
dotnet-monitor-1  |    at Microsoft.Diagnostics.Tools.Monitor.Commands.CollectCommandHandler.Invoke(CancellationToken token, String[] urls, String[] metricUrls, Boolean metrics, String diagnosticPort, Boolean noAuth, Boolean tempApiKey, Boolean noHttpEgress, FileInfo configurationFilePath, Boolean exitOnStdinDisconnect)
dotnet-monitor-1  |    at Microsoft.Diagnostics.Tools.Monitor.Commands.CollectCommandHandler.Invoke(CancellationToken token, String[] urls, String[] metricUrls, Boolean metrics, String diagnosticPort, Boolean noAuth, Boolean tempApiKey, Boolean noHttpEgress, FileInfo configurationFilePath, Boolean exitOnStdinDisconnect)
dotnet-monitor-1  |    at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
dotnet-monitor-1 exited with code 1
exampleapp-1      | The runtime has been configured to pause during startup and is awaiting a Diagnostics IPC ResumeStartup command from a Diagnostic Port.
exampleapp-1      | DOTNET_DiagnosticPorts="/diag/dotnet-monitor.sock"
exampleapp-1      | DOTNET_DefaultDiagnosticPortSuspend=0

Configuration

  • Is this related to a specific tool? No
  • What OS and version, and what distro if applicable? Win11 23H2 (OS Build 10.0.22631.3880)
  • What is the architecture? x64
  • Do you know whether it is specific to that configuration? I don't know
  • Are you running in any particular type of environment? Docker Desktop for Windows (i.e. WSL2 2.0.4.0)
  • Is it a self-contained published application? Somehow - it's a prebuilt Docker image (example app of ASP.NET Core, provided by Microsoft)
  • What's the output of dotnet info:
Output of `dotnet info`
.NET SDK:
 Version:           8.0.303
 Commit:            29ab8e3268
 Workload version:  8.0.300-manifests.34944930
 MSBuild version:   17.10.4+10fbfbf2e

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22631
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.303\

.NET workloads installed:
 [aspire]
   Installation Source: VS 17.10.35027.167
   Manifest Version:    8.0.0/8.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.0.0\WorkloadManifest.json
   Install Type:        FileBased


Host:
  Version:      8.0.7
  Architecture: x64
  Commit:       2aade6beb0

.NET SDKs installed:
  3.1.426 [C:\Program Files\dotnet\sdk]
  5.0.408 [C:\Program Files\dotnet\sdk]
  6.0.100 [C:\Program Files\dotnet\sdk]
  6.0.131 [C:\Program Files\dotnet\sdk]
  6.0.321 [C:\Program Files\dotnet\sdk]
  8.0.303 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Regression?

I don't know, but I found this post in a Docker forum, so I assume that it used to work for the user.

Other information

/

@mu88 mu88 added the bug Something isn't working label Jul 21, 2024
Copy link
Contributor

Welcome to dotnet-monitor!

Thanks for creating your first issue; let us know what you think of dotnet-monitor by filling out our survey.

@wiktork wiktork self-assigned this Aug 7, 2024
@wiktork
Copy link
Member

wiktork commented Aug 8, 2024

@mu88 There are two requirements to establish connectivity with dotnet-monitor and the app:

  • The users of each container should ideally be the same
  • The user needs r/w permissions to the volume mount

In 8.0, we no longer run as root by default. I'm not that familiar with docker compose, but to fix your example, I was able to add user: root to both containers.

Ideally you would have the same non-privileged user running both containers, but you'll need to also grant permissions for that user to the volume.

@mu88
Copy link
Author

mu88 commented Aug 12, 2024

Thx @wiktork ! Where would I have found this information in the docs?

@mu88
Copy link
Author

mu88 commented Aug 18, 2024

@wiktork: with the following docker-compose.yml, I can now successfully start the stack:

services:
  exampleapp:
    image: mcr.microsoft.com/dotnet/samples:aspnetapp
    user: root
    ports:
      - "8080:8080"
    volumes:
      - diagvol:/diag
    environment:
      - DOTNET_DiagnosticPorts=/diag/dotnet-monitor.sock
  dotnet-monitor:
    image: mcr.microsoft.com/dotnet/monitor:8
    ports:
      - "52323:52323"
      - "52325:52325"
    user: root
    volumes:
      - diagvol:/diag
    command: ["collect", "--no-auth"]
    environment:
      - DOTNETMONITOR_DiagnosticPort__ConnectionMode=Listen
      - DOTNETMONITOR_Storage__DefaultSharedPath=/diag
      - DOTNETMONITOR_Urls=http://localhost:52323
      - DOTNETMONITOR_Metrics__Endpoints=http://+:52325

volumes:
  diagvol:

According to the API docs of GET /processes, I'd assume that the command curl http://localhost:52323/processes should now work, right? However, this gives me the following error:

myUser@myRaspi:~/temp $ curl http://localhost:52323/processes
curl: (56) Recv failure: Connection reset by peer

@jander-msft
Copy link
Member

Thx @wiktork ! Where would I have found this information in the docs?

Compatibility docs describe the scenario here: https://github.com/dotnet/dotnet-monitor/blob/main/documentation/compatibility/8.0/README.md#docker-non-root-by-default

We can probably add more pointers from the rest of the docs to this existing doc to help people find the information and resolution more easily.

@jander-msft
Copy link
Member

According to the API docs of GET /processes, I'd assume that the command curl http://localhost:52323/processes should now work, right? However, this gives me the following error:

myUser@myRaspi:~/temp $ curl http://localhost:52323/processes
curl: (56) Recv failure: Connection reset by peer

If you adjust the URL to bind to any host instead of localhost, then it works:

- DOTNETMONITOR_Urls=http://localhost:52323
+ DOTNETMONITOR_Urls=http://+:52323

The .NET Monitor image as-is binds its URLs to any host by default.

@mu88
Copy link
Author

mu88 commented Oct 5, 2024

That works like a charm, thank you very much!

@mu88 mu88 closed this as completed Oct 5, 2024
@mu88
Copy link
Author

mu88 commented Dec 8, 2024

@jander-msft sorry for bothering you again with this issue :/

After upgrading my stack to .NET 9, the previous approach no longer works. In the logs of the dotnet monitor container, I see a bunch of "Category":"Microsoft.Diagnostics.Tools.Monitor.ServerEndpointInfoSource","Message":"Unexpected timeout from process 1. Process will no longer be monitored." warnings.

Have there been any changes related to .NET 9 that I should be aware of? 🤔

Here you find all the logs from the `dotnet monitor` container
{"Timestamp":"2024-12-06T14:39:26.0658354Z","EventId":60,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.Startup","Message":"Tell us about your experience with dotnet monitor: https://aka.ms/dotnet-monitor-survey","State":{"Message":"Tell us about your experience with dotnet monitor: https://aka.ms/dotnet-monitor-survey","link":"https://aka.ms/dotnet-monitor-survey","{OriginalFormat}":"Tell us about your experience with dotnet monitor: {link}"},"Scopes":[]}
{"Timestamp":"2024-12-06T14:39:26.1099640Z","EventId":77,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.Startup","Message":"Connection mode: Listen at \u0027/diag/dotnet-monitor.sock\u0027","State":{"Message":"Connection mode: Listen at \u0027/diag/dotnet-monitor.sock\u0027","path":"/diag/dotnet-monitor.sock","{OriginalFormat}":"Connection mode: Listen at \u0027{path}\u0027"},"Scopes":[]}
{"Timestamp":"2024-12-06T14:39:26.1213346Z","EventId":13,"LogLevel":"Warning","Category":"Microsoft.Diagnostics.Tools.Monitor.Startup","Message":"WARNING: Authentication has been disabled. This can pose a security risk and is not intended for production environments.","State":{"Message":"WARNING: Authentication has been disabled. This can pose a security risk and is not intended for production environments.","{OriginalFormat}":"WARNING: Authentication has been disabled. This can pose a security risk and is not intended for production environments."},"Scopes":[]}
{"Timestamp":"2024-12-06T14:39:26.6978671Z","EventId":14,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://[::]:52323","State":{"Message":"Now listening on: http://[::]:52323","address":"http://[::]:52323","{OriginalFormat}":"Now listening on: {address}"},"Scopes":[]}
{"Timestamp":"2024-12-06T14:39:26.6980055Z","EventId":14,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://[::]:52325","State":{"Message":"Now listening on: http://[::]:52325","address":"http://[::]:52325","{OriginalFormat}":"Now listening on: {address}"},"Scopes":[]}
{"Timestamp":"2024-12-06T14:39:26.8712346Z","EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Application started. Press Ctrl\u002BC to shut down.","State":{"Message":"Application started. Press Ctrl\u002BC to shut down.","{OriginalFormat}":"Application started. Press Ctrl\u002BC to shut down."},"Scopes":[]}
{"Timestamp":"2024-12-06T14:39:26.8752496Z","EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Hosting environment: Production","State":{"Message":"Hosting environment: Production","EnvName":"Production","{OriginalFormat}":"Hosting environment: {EnvName}"},"Scopes":[]}
{"Timestamp":"2024-12-06T14:39:26.8755551Z","EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Content root path: /app/","State":{"Message":"Content root path: /app/","ContentRoot":"/app/","{OriginalFormat}":"Content root path: {ContentRoot}"},"Scopes":[]}
{"Timestamp":"2024-12-06T14:39:47.9858791Z","EventId":52,"LogLevel":"Warning","Category":"Microsoft.Diagnostics.Tools.Monitor.ServerEndpointInfoSource","Message":"Unexpected timeout from process 1. Process will no longer be monitored.","State":{"Message":"Unexpected timeout from process 1. Process will no longer be monitored.","processId":"1","{OriginalFormat}":"Unexpected timeout from process {processId}. Process will no longer be monitored."},"Scopes":[]}
{"Timestamp":"2024-12-06T14:39:48.0006034Z","EventId":44,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"Stopping collection rules.","State":{"Message":"Stopping collection rules.","{OriginalFormat}":"Stopping collection rules."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:6d2bcb3d457f4fba9480869225e82fba","TargetProcessId":"1","TargetRuntimeInstanceCookie":"6d2bcb3d457f4fba9480869225e82fba"}]}
{"Timestamp":"2024-12-06T14:39:48.0074402Z","EventId":45,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"All collection rules have stopped.","State":{"Message":"All collection rules have stopped.","{OriginalFormat}":"All collection rules have stopped."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:6d2bcb3d457f4fba9480869225e82fba","TargetProcessId":"1","TargetRuntimeInstanceCookie":"6d2bcb3d457f4fba9480869225e82fba"}]}
{"Timestamp":"2024-12-06T14:40:17.1351507Z","EventId":52,"LogLevel":"Warning","Category":"Microsoft.Diagnostics.Tools.Monitor.ServerEndpointInfoSource","Message":"Unexpected timeout from process 1. Process will no longer be monitored.","State":{"Message":"Unexpected timeout from process 1. Process will no longer be monitored.","processId":"1","{OriginalFormat}":"Unexpected timeout from process {processId}. Process will no longer be monitored."},"Scopes":[]}
{"Timestamp":"2024-12-06T14:40:17.1357625Z","EventId":44,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"Stopping collection rules.","State":{"Message":"Stopping collection rules.","{OriginalFormat}":"Stopping collection rules."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:4e5f7b8c534043e4a92408d3c824511b","TargetProcessId":"1","TargetRuntimeInstanceCookie":"4e5f7b8c534043e4a92408d3c824511b"}]}
{"Timestamp":"2024-12-06T14:40:17.1359973Z","EventId":45,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"All collection rules have stopped.","State":{"Message":"All collection rules have stopped.","{OriginalFormat}":"All collection rules have stopped."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:4e5f7b8c534043e4a92408d3c824511b","TargetProcessId":"1","TargetRuntimeInstanceCookie":"4e5f7b8c534043e4a92408d3c824511b"}]}
{"Timestamp":"2024-12-06T14:40:51.2381770Z","EventId":52,"LogLevel":"Warning","Category":"Microsoft.Diagnostics.Tools.Monitor.ServerEndpointInfoSource","Message":"Unexpected timeout from process 1. Process will no longer be monitored.","State":{"Message":"Unexpected timeout from process 1. Process will no longer be monitored.","processId":"1","{OriginalFormat}":"Unexpected timeout from process {processId}. Process will no longer be monitored."},"Scopes":[]}
{"Timestamp":"2024-12-06T14:40:51.2387901Z","EventId":44,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"Stopping collection rules.","State":{"Message":"Stopping collection rules.","{OriginalFormat}":"Stopping collection rules."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:1cc66f6b47cf49c3bc7fa319c73c7c36","TargetProcessId":"1","TargetRuntimeInstanceCookie":"1cc66f6b47cf49c3bc7fa319c73c7c36"}]}
{"Timestamp":"2024-12-06T14:40:51.2390320Z","EventId":45,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"All collection rules have stopped.","State":{"Message":"All collection rules have stopped.","{OriginalFormat}":"All collection rules have stopped."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:1cc66f6b47cf49c3bc7fa319c73c7c36","TargetProcessId":"1","TargetRuntimeInstanceCookie":"1cc66f6b47cf49c3bc7fa319c73c7c36"}]}
{"Timestamp":"2024-12-06T14:45:54.5426282Z","EventId":52,"LogLevel":"Warning","Category":"Microsoft.Diagnostics.Tools.Monitor.ServerEndpointInfoSource","Message":"Unexpected timeout from process 1. Process will no longer be monitored.","State":{"Message":"Unexpected timeout from process 1. Process will no longer be monitored.","processId":"1","{OriginalFormat}":"Unexpected timeout from process {processId}. Process will no longer be monitored."},"Scopes":[]}
{"Timestamp":"2024-12-06T14:45:54.5432679Z","EventId":44,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"Stopping collection rules.","State":{"Message":"Stopping collection rules.","{OriginalFormat}":"Stopping collection rules."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:81971a695c8a445c9ee90e15b6807f05","TargetProcessId":"1","TargetRuntimeInstanceCookie":"81971a695c8a445c9ee90e15b6807f05"}]}
{"Timestamp":"2024-12-06T14:45:54.5435840Z","EventId":45,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"All collection rules have stopped.","State":{"Message":"All collection rules have stopped.","{OriginalFormat}":"All collection rules have stopped."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:81971a695c8a445c9ee90e15b6807f05","TargetProcessId":"1","TargetRuntimeInstanceCookie":"81971a695c8a445c9ee90e15b6807f05"}]}
{"Timestamp":"2024-12-06T15:05:32.3461761Z","EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Application is shutting down...","State":{"Message":"Application is shutting down...","{OriginalFormat}":"Application is shutting down..."},"Scopes":[]}
{"Timestamp":"2024-12-06T15:05:37.7939278Z","EventId":60,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.Startup","Message":"Tell us about your experience with dotnet monitor: https://aka.ms/dotnet-monitor-survey","State":{"Message":"Tell us about your experience with dotnet monitor: https://aka.ms/dotnet-monitor-survey","link":"https://aka.ms/dotnet-monitor-survey","{OriginalFormat}":"Tell us about your experience with dotnet monitor: {link}"},"Scopes":[]}
{"Timestamp":"2024-12-06T15:05:37.8515656Z","EventId":77,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.Startup","Message":"Connection mode: Listen at \u0027/diag/dotnet-monitor.sock\u0027","State":{"Message":"Connection mode: Listen at \u0027/diag/dotnet-monitor.sock\u0027","path":"/diag/dotnet-monitor.sock","{OriginalFormat}":"Connection mode: Listen at \u0027{path}\u0027"},"Scopes":[]}
{"Timestamp":"2024-12-06T15:05:37.8680855Z","EventId":13,"LogLevel":"Warning","Category":"Microsoft.Diagnostics.Tools.Monitor.Startup","Message":"WARNING: Authentication has been disabled. This can pose a security risk and is not intended for production environments.","State":{"Message":"WARNING: Authentication has been disabled. This can pose a security risk and is not intended for production environments.","{OriginalFormat}":"WARNING: Authentication has been disabled. This can pose a security risk and is not intended for production environments."},"Scopes":[]}
{"Timestamp":"2024-12-06T15:05:39.0373868Z","EventId":14,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://[::]:52323","State":{"Message":"Now listening on: http://[::]:52323","address":"http://[::]:52323","{OriginalFormat}":"Now listening on: {address}"},"Scopes":[]}
{"Timestamp":"2024-12-06T15:05:39.0376199Z","EventId":14,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://[::]:52325","State":{"Message":"Now listening on: http://[::]:52325","address":"http://[::]:52325","{OriginalFormat}":"Now listening on: {address}"},"Scopes":[]}
{"Timestamp":"2024-12-06T15:05:39.5121542Z","EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Application started. Press Ctrl\u002BC to shut down.","State":{"Message":"Application started. Press Ctrl\u002BC to shut down.","{OriginalFormat}":"Application started. Press Ctrl\u002BC to shut down."},"Scopes":[]}
{"Timestamp":"2024-12-06T15:05:39.5169853Z","EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Hosting environment: Production","State":{"Message":"Hosting environment: Production","EnvName":"Production","{OriginalFormat}":"Hosting environment: {EnvName}"},"Scopes":[]}
{"Timestamp":"2024-12-06T15:05:39.5174841Z","EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Content root path: /app/","State":{"Message":"Content root path: /app/","ContentRoot":"/app/","{OriginalFormat}":"Content root path: {ContentRoot}"},"Scopes":[]}
{"Timestamp":"2024-12-06T15:05:44.6601112Z","EventId":52,"LogLevel":"Warning","Category":"Microsoft.Diagnostics.Tools.Monitor.ServerEndpointInfoSource","Message":"Unexpected timeout from process 1. Process will no longer be monitored.","State":{"Message":"Unexpected timeout from process 1. Process will no longer be monitored.","processId":"1","{OriginalFormat}":"Unexpected timeout from process {processId}. Process will no longer be monitored."},"Scopes":[]}
{"Timestamp":"2024-12-06T15:05:44.6782440Z","EventId":44,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"Stopping collection rules.","State":{"Message":"Stopping collection rules.","{OriginalFormat}":"Stopping collection rules."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:bb0f9325627e49d28140c6c9e14ce5fe","TargetProcessId":"1","TargetRuntimeInstanceCookie":"bb0f9325627e49d28140c6c9e14ce5fe"}]}
{"Timestamp":"2024-12-06T15:05:44.6839056Z","EventId":45,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"All collection rules have stopped.","State":{"Message":"All collection rules have stopped.","{OriginalFormat}":"All collection rules have stopped."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:bb0f9325627e49d28140c6c9e14ce5fe","TargetProcessId":"1","TargetRuntimeInstanceCookie":"bb0f9325627e49d28140c6c9e14ce5fe"}]}
{"Timestamp":"2024-12-06T15:05:57.3403342Z","EventId":52,"LogLevel":"Warning","Category":"Microsoft.Diagnostics.Tools.Monitor.ServerEndpointInfoSource","Message":"Unexpected timeout from process 1. Process will no longer be monitored.","State":{"Message":"Unexpected timeout from process 1. Process will no longer be monitored.","processId":"1","{OriginalFormat}":"Unexpected timeout from process {processId}. Process will no longer be monitored."},"Scopes":[]}
{"Timestamp":"2024-12-06T15:05:57.3411549Z","EventId":44,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"Stopping collection rules.","State":{"Message":"Stopping collection rules.","{OriginalFormat}":"Stopping collection rules."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:59c7b598f8e948d9bf610f60ebdd2e61","TargetProcessId":"1","TargetRuntimeInstanceCookie":"59c7b598f8e948d9bf610f60ebdd2e61"}]}
{"Timestamp":"2024-12-06T15:05:57.3414537Z","EventId":45,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"All collection rules have stopped.","State":{"Message":"All collection rules have stopped.","{OriginalFormat}":"All collection rules have stopped."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:59c7b598f8e948d9bf610f60ebdd2e61","TargetProcessId":"1","TargetRuntimeInstanceCookie":"59c7b598f8e948d9bf610f60ebdd2e61"}]}
{"Timestamp":"2024-12-06T15:06:03.6034925Z","EventId":52,"LogLevel":"Warning","Category":"Microsoft.Diagnostics.Tools.Monitor.ServerEndpointInfoSource","Message":"Unexpected timeout from process 1. Process will no longer be monitored.","State":{"Message":"Unexpected timeout from process 1. Process will no longer be monitored.","processId":"1","{OriginalFormat}":"Unexpected timeout from process {processId}. Process will no longer be monitored."},"Scopes":[]}
{"Timestamp":"2024-12-06T15:06:03.6040053Z","EventId":44,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"Stopping collection rules.","State":{"Message":"Stopping collection rules.","{OriginalFormat}":"Stopping collection rules."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:81a3743a5510488880a109f0ca0a25de","TargetProcessId":"1","TargetRuntimeInstanceCookie":"81a3743a5510488880a109f0ca0a25de"}]}
{"Timestamp":"2024-12-06T15:06:03.6042236Z","EventId":45,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"All collection rules have stopped.","State":{"Message":"All collection rules have stopped.","{OriginalFormat}":"All collection rules have stopped."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:81a3743a5510488880a109f0ca0a25de","TargetProcessId":"1","TargetRuntimeInstanceCookie":"81a3743a5510488880a109f0ca0a25de"}]}
{"Timestamp":"2024-12-06T15:06:44.9605871Z","EventId":52,"LogLevel":"Warning","Category":"Microsoft.Diagnostics.Tools.Monitor.ServerEndpointInfoSource","Message":"Unexpected timeout from process 1. Process will no longer be monitored.","State":{"Message":"Unexpected timeout from process 1. Process will no longer be monitored.","processId":"1","{OriginalFormat}":"Unexpected timeout from process {processId}. Process will no longer be monitored."},"Scopes":[]}
{"Timestamp":"2024-12-06T15:06:44.9619404Z","EventId":44,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"Stopping collection rules.","State":{"Message":"Stopping collection rules.","{OriginalFormat}":"Stopping collection rules."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:aaf148c93e254a45b3c54b345ef1f1b1","TargetProcessId":"1","TargetRuntimeInstanceCookie":"aaf148c93e254a45b3c54b345ef1f1b1"}]}
{"Timestamp":"2024-12-06T15:06:44.9621844Z","EventId":45,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"All collection rules have stopped.","State":{"Message":"All collection rules have stopped.","{OriginalFormat}":"All collection rules have stopped."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:aaf148c93e254a45b3c54b345ef1f1b1","TargetProcessId":"1","TargetRuntimeInstanceCookie":"aaf148c93e254a45b3c54b345ef1f1b1"}]}
{"Timestamp":"2024-12-06T15:06:57.8922407Z","EventId":52,"LogLevel":"Warning","Category":"Microsoft.Diagnostics.Tools.Monitor.ServerEndpointInfoSource","Message":"Unexpected timeout from process 1. Process will no longer be monitored.","State":{"Message":"Unexpected timeout from process 1. Process will no longer be monitored.","processId":"1","{OriginalFormat}":"Unexpected timeout from process {processId}. Process will no longer be monitored."},"Scopes":[]}
{"Timestamp":"2024-12-06T15:06:57.8928563Z","EventId":44,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"Stopping collection rules.","State":{"Message":"Stopping collection rules.","{OriginalFormat}":"Stopping collection rules."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:498ce5bf579f45fd93fb23cae1222473","TargetProcessId":"1","TargetRuntimeInstanceCookie":"498ce5bf579f45fd93fb23cae1222473"}]}
{"Timestamp":"2024-12-06T15:06:57.8931375Z","EventId":45,"LogLevel":"Information","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"All collection rules have stopped.","State":{"Message":"All collection rules have stopped.","{OriginalFormat}":"All collection rules have stopped."},"Scopes":[{"Message":"TargetProcessId:1 TargetRuntimeInstanceCookie:498ce5bf579f45fd93fb23cae1222473","TargetProcessId":"1","TargetRuntimeInstanceCookie":"498ce5bf579f45fd93fb23cae1222473"}]}
Here you find my `docker-compose.yml`.
services:
  thisisyourlife:
    image: mu88/thisisyourlife:4.0.0-chiseled
    container_name: thisisyourlife
    depends_on:
      - dotnet-monitor
    user: app
    environment:
      - OTEL_EXPORTER_OTLP_ENDPOINT=http://opentelemetry-collector:4317
      - DOTNET_DiagnosticPorts=/diag/dotnet-monitor.sock
    volumes:
      - ./data/:/home/app/data
      - ./dotnet-monitor/data/:/diag

  # 3 other ASP.NET Core 9 apps following the same pattern like the previous one
  # other services necessary for the observability stack (e.g. Grafana, OpenTelemetry exporter)

  dotnet-monitor:
    image: mcr.microsoft.com/dotnet/monitor:9
    container_name: monitoring-dotnet-monitor
    ports:
      - "127.0.0.1:52323:52323"
      - "127.0.0.1:52325:52325"
    user: app
    volumes:
      - ./dotnet-monitor/data/:/diag
    command: ["collect", "--no-auth"]
    environment:
      - DOTNETMONITOR_DiagnosticPort__ConnectionMode=Listen
      - DOTNETMONITOR_Storage__DefaultSharedPath=/diag
      - DOTNETMONITOR_Urls=http://+:52323
      - DOTNETMONITOR_Metrics__Endpoints=http://+:52325

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants