.NET Core Diagnostics in Docker

  1. Is my application healthy?
  2. Why does my application have anomalous behavior?
  3. Why did my application crash?

The Tools

dotnet-counters

dotnet-trace

dotnet-dump

Collect Diagnostics in Docker Containers

  1. Install the tools anytime via a single-file distribution mechanism that only requires a runtime (3.1+)
  2. Install the tools in the initial Docker image

1. Install the tools via single-file distribution mechanism

<https://aka.ms/><tool-name>/<platform-runtime-identifier>

2. Install the tools in the initial Docker image

# In build stage
# Install desired .NET CLI diagnostics tool
RUN dotnet tool install --tool-path /tools dotnet-dump
...# In final stage
# Copy diagnostics tools
WORKDIR /tools
COPY --from=build /tools .

Accessing the tools at runtime

docker ps
docker exec -it -w /tools <ID> /bin/sh
./dotnet-dump ps
./dotnet-dump collect -p <PID> --type Full -o /tmp/dump1.core

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Dec, 10th at 8 PM, BitCherry Testnet AMA Event On Telegram

Kong API Security in Kubernetes with API Key and JWT

Streaming Video Analytics with Gstreamer and Kafka

Creating a Chatbot with Square Checkout and Twilio Studio

Client/Server Communication — Chapter 4

Accelerating Progrexion Through Adobe Experience Manager

Rust Iterators

How To Master Your Async Queues

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ademar Gonçalves

Ademar Gonçalves

More from Medium

Fixing my BF1942 woes with Win32 APIs

Real-time Code Quality with SonarLint in Visual Studio

Complete Blazor (WASM & Server) And ASP.NET API Development

Complete Blazor (WASM & Server) And ASP.NET API Development

How to access files in the backend on .NET Core?