I started a couple of days ago trying to accomplish something that seemed to be very easy, but it turned out to be very unclear and complex. Hence, hoping someone has a good answer.
This is what I've done:
Created a ASP.NET Core 2.0 Web Application (Web API) project in Visual Studio.
Enabled Docker support (which created Dockerfile, and the docker-compose project).
Published it successfully to Azure with the "App Service Linux" publish profile.
Created a Azure File Share and successfully mapped that on my windows pc and added some files.
Now I want to access this file share from my web application. However, I can't find any solution how to access this share, or how to add this share as a volume in my Docker container, so that I can access it with SMB. I've read Use
Azure Files with Linux as well as Docker Volume Driver for Azure File Storage and Persisting
connections to Microsoft Azure Files, but none of them gives an answer on how to configure my Dockerfile or docker-compose to map my share. Neither gives it a clue on how to do it after deployment to Azure.
The Docker container created when publishing from Visual Studio does not have SSH included, neither is it installed in a swarm which seems to be required if you want to use Cloudstor.
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
thanks for the answer. Yes, I've read those, but was hoping that I read it wrong. Since SMB is the only option I my scenario, I can't go with the SDK (even though the article mentions System.IO).
Maybe Cloudstor is the option, which comes with Docker for Azure? This would opt out of Azure App Service though.
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
None
0 Points
4 Posts
How to use Azure File Share (SMB) from a docker-enabled ASP.NET Core (Web API) project
Mar 16, 2018 07:35 AM|SWarnberg|LINK
I started a couple of days ago trying to accomplish something that seemed to be very easy, but it turned out to be very unclear and complex. Hence, hoping someone has a good answer.
This is what I've done:
Now I want to access this file share from my web application. However, I can't find any solution how to access this share, or how to add this share as a volume in my Docker container, so that I can access it with SMB. I've read Use Azure Files with Linux as well as Docker Volume Driver for Azure File Storage and Persisting connections to Microsoft Azure Files, but none of them gives an answer on how to configure my Dockerfile or docker-compose to map my share. Neither gives it a clue on how to do it after deployment to Azure.
The Docker container created when publishing from Visual Studio does not have SSH included, neither is it installed in a swarm which seems to be required if you want to use Cloudstor.
/Staffan
Star
9831 Points
3120 Posts
Re: How to use Azure File Share (SMB) from a docker-enabled ASP.NET Core (Web API) project
Mar 20, 2018 01:31 AM|Brando ZWZ|LINK
Hi SWarnberg,
As far as I know, we couldn't mount the azure file share in web app service.
If you mount the file share, it will show "permission denied".
Besides, there is a feedback which says azure team will not allow mount the file share in app service.
Link:https://feedback.azure.com/forums/169385-web-apps/suggestions/6084609-allow-map-azure-file-share-microsoft-azure-file-s
Here is a workaround, if you want to access the fileshare's file in asp.net core.
I suggest you could try to use azure file storage SDK.
More details, you could refer to below article.
https://docs.microsoft.com/en-us/azure/storage/files/storage-dotnet-how-to-use-files
Best Regards,
Brando
None
0 Points
4 Posts
Re: How to use Azure File Share (SMB) from a docker-enabled ASP.NET Core (Web API) project
Mar 21, 2018 09:30 AM|SWarnberg|LINK
Hi,
thanks for the answer. Yes, I've read those, but was hoping that I read it wrong. Since SMB is the only option I my scenario, I can't go with the SDK (even though the article mentions System.IO).
Maybe Cloudstor is the option, which comes with Docker for Azure? This would opt out of Azure App Service though.
https://docs.docker.com/docker-for-azure/persistent-data-volumes/
Staffan
Star
9831 Points
3120 Posts
Re: How to use Azure File Share (SMB) from a docker-enabled ASP.NET Core (Web API) project
Mar 23, 2018 07:58 AM|Brando ZWZ|LINK
Hi SWarnberg,
Yes, we couldn't use azure web app for mounting.
I suggest you could consider using azure container service.
We could use this service work with docker to mount the file share.
More details, you could refer to below article.
https://azure.microsoft.com/en-us/resources/videos/using-azure-container-service-with-docker/
Best Regards,
Brando