Not able to access network path from containerized application

I have a application to read files from network path and upload it. When I try this workflow from windows container, I am getting “Access to the path ‘\servername\sharepath’ is denied” exception. Can you help me how to access network path from ASP.Net MVC application (C# programming) on the container environment? Sample docker file will be more helpful.

Is it a Windows container or Linux? On Windows, shouldn’t the network path be \\servername\sharepath?
And if servername doesn’t work, try the IP address. On Linux, it depends on the context and could be smb://servername/sharepath or just //servername/sharepath or similar with an IP address.


Can you use the same path on the Windows host from powershell or comand line? I almost always used it from the file browser and I don’t remember the correct way from powershell but that is probably what you have in the container. I also don’t know how an ASP .NET app should refer to thse paths if that is what you are trying to do.

It is for windows container. I am able to access the network path from container’s PowerShell by authenticating through one of the user. But I would need to connect the network path from my containerized application.

The container an isolated environment. Authenticating on the host will not help you in the container. Just imagine that just because someone on the host authenticates and reads or writes a network share, a process in the container could do it too. I haven’T tried but I hope that doesn’T work and I would be surprised. Windows containers also have two kind of isolation. Process and HyperV. Often the HyperV isolation is used so you have a virtual machine which would make it even harder to see anything on the host. I don’t know how mounting network shares work on Windows, but that is something you could try, or pass credentials to the container.

I found this: