I’m in the process of containerizing an ASP.NET Core 6.0 WebApi project.
I’m using a mcr.microsoft.com/dotnet/aspnet:6.0
container, which seems to be based on Debian Bullseye.
I’m at the point where the image is running, but am not sure how to deal with ProgramData folders. Basically when I used to host the app on Windows, I would use the C:\ProgramData
folder to store all changing data including logs, custom user image/audio uploads etc.
As an example let’s take logs. On Windows Server I was using NLog, to log to C:\ProgramData\MyCompany\MyApp\Logs
. Now that the container is running on linux, that path no longer exists. I’m assuming those logs are just not going anywhere at that point.
What’s the right approach to correcting that?
-
I’m assuming I need to modify my application logging destination to for example
/data
directory inside the container? The only reason I’m saying/data
is because the actual app resides in/app
, as per sample Dockerfile provided by Microsoft. -
Or is there a way I can use a volume command inside docker compose to direct the image to automatically map calls to
C:\ProgramData\MyCompany\MyApp\
to/data
?