Running dotTrace Remote Agent or command line in Linux Docker container.

I'm trying to run the dotTrace profiler and having some issues. My application is dotnet Core 3.1, running inside a debian docker container based on docker image.

There is very little documentation about a setup where dotTrace is used in an environment where the application is running remotely in a linux container.  I feel this is becoming more common and documentation and dotTrace functionality needs to cover this scenario.  I've tried multiple setups; 1 where I attempt to run in the container and 2; where I attempt to remotely connect to the container.

Setup 1: running within the container.

In this scenario I install the dothet-sdk-3.1 then download the dotTrace Command Line Tools (JetBrains.dotTrace.CommandLineTools.linux-x64.2020.3.2.tar.gz)  Since the application is dockerized, it is already running in the container when I connect.

#ps aux 
root 13 1.2 6.3 12111520 130248 ? Sl 23:37 0:05 dotnet App.Web.RService.dll 

When I attempt to connect based on the documentation here (

I get the following error

root@c1da3dfe832b:/dotTrace# ./ attach 13
dotTrace Console Profiler 2020.3.2 build 777.0.20201229.110730. Copyright (C) 2020 JetBrains s.r.o.
Profiling in progress...
Unable to start profiling. Profiler attach failed (HRESULT: 0x8013136A).

No other information is given.  

Setup 2: Attempting to connect remotely.

This scenario did not make it far at all as there doesn't seem to be a RemoteAgent for linux. Only for Windows. ( The documentation is very Windows specific.  I have not tried installing Mono and running the Remote Agent as I have already burned enough time on this project.

Are either of these things actually possible?  Is there supporting documentation?

Thanks for looking.



Thank you for the feedback! We'll add additional documentation on profiling in Docker containers in the near future.
About Setup 1: there should be a human-readable error message in this case, it's our fault; we will fix this in the next version.
The error code corresponds to the "The request to attach a profiler was denied because a profiler is already loaded" error in .NET. Are you using other profilers or monitoring tools? Have you previously attached to the profiled process? Note that you need to correctly detach from a profiled process, so using the --timeout or --service-input=stdin parameters is recommended.
About Setup 2: indeed, there is no Remote Agent for Linux. Moreover, we are going to discard it even on Windows.


It would help a lot if usage in docker containers would be better documented - if that would be done in AWS ECS Fargate context - would be even better, because there are some limitations in there, especially if you try to profile startup and then get the collected snapshots before your container got killed.

Anyway, I've downloaded linux cmd tools and was not able to make them run in image, I've added tools to it like this:

RUN mkdir -p /opt/profiling
RUN curl -L \
| tar xzf - -C /opt/profiling

And then when I connected through terminal and tried to execute ./ it was complaining like this:

./ exec: line 25: /opt/profiling/linux-x64/dotnet/dotnet: not found

I've checked - dotnet existed at given path, it had executable rights - so I have no idea what was going on - on my ubuntu virtual machine downloading command and worked fine.





I'm in a similar situation to David and Giedrius - How do I profile apps running in Linux containers in my dev env? It all seems... complicated.

I've spent today trying to get some performance timing for code execution with a couple of dotnet5 apps in Ubuntu Docker containers on my local Windows machine. They are built and debugged in VS2019 with a docker-compose run/debug profile (just the standard orchestration generated by VS) which launches the apps and attaches debuggers if required. In each container I can then copy across the dotTrace tools Within each container I can then attach a dotTrace session to the running application:

./ attach <pid> --save-to=./snapshots/snapshot.dtp --timeout=30s

I didn't have much success trying to list the PIDs but helpfully enough if you put in something wrong for the PID outputs the running processes for you to pick from. Attached to the one from the list and it produces a snapshot after 30s.

Then I can then copy the snapshot files back to the host, but I can't open them in VS2019 with ReSharper as this only seems to want to load .dtt - timeline snapshots. I've got .dtp files so I open these in the dotTrace desktop app and well I don't know what I'm looking at and trying to figure that out but it doesn't have access to source code and fails to decompile from some place it expected to.

Looking forward to these instructions Konstantin!


About the issues with docker image: unfortunately, all musl-based Linux distributives (including Alpine) are currently not supported. We are working on it and going to support them in the near future.

The corresponding issue in our tracker:



Actually, you've done it the right way. Only .dtp snapshots can be taken on Linux, and currently, they can be opened only in dotTrace Performance Viewer and Rider (and can't be opened in Visual Studio).

You can read more about how to analyze such snapshots in the corresponding section of our documentation:


Konstantin, ok, I've tried to switch to buster to profile app startup and it is just hard:

root@0ea8475b3137:/app# ./../opt/dottrace/dottrace start -framework=NetCore --save-to=snapshot.dtp ./Api.
dotTrace command-line profiler 2021.1.3 build 777.0.20210525.202333. Copyright (C) 2021 JetBrains s.r.o.
Profiling in progress...
Unable to start profiling. Permission denied.

Have no clue how to proceed further, what kind of permissions are needed and for what. We need more documentation on how it works and how to troubleshoot it :)


Please sign in to leave a comment.