在 Azure 应用服务中使用 docker 容器时装载卷

Mount a volume while using a docker container in Azure App Service

我已经在 Azure 上部署了一个 Web App,并使用 public 注册表中的一个 Docker 容器(我自己的映像)来托管我的网站。但用户可以上传图片,数据存储在服务器上的json-文件中。当然,我想将这些文件写入容器外的挂载卷。这样我就可以在不丢失数据的情况下重新部署我的网站的更新版本。

Web 应用程序可以吗?或者我是否需要在 Azure 上使用 Docker 移动到 Ubuntu VM?我喜欢 webapps 的地方是我不必担心管理 VM 而只关心我的容器。

这篇博客 post 是一个很好的开始,它让我们了解了 Azure 关于卷安装的策略(A​​SL == App Services on Linux; ASW=Windows 上的应用服务):

... However, in this case, we would like to leverage the regular App Service Filesystem, so we can interact with the application using FTP. When a container is deployed, ASL mounts the equivalent of D:\home path on ASW to /home (using volume mount in Docker). Now when that happens, it is up to your container to map the corresponding paths into the application. In order to understand how this works more closely, take a look at the official Dockerfile used in PHP7 container on ASL.

https://hajekj.net/2016/12/25/building-custom-docker-images-for-use-in-app-service-on-linux/