When specifying a docker volume in a dockerfile, docker creates a volume when the container is started. As expected the directories that are defined are there when logged into the container at the expected paths. However, when using the same image in Azure Webapp for Linux, while logging into the container, the expected paths and files are not there.
Does azure webapp not support this or is there some setting that I'm missing and need to enable? I'm not talking of mounting a filesystem/storage account as documented here.
CodePudding user response:
That won't work. The alternative is to enable Persistent Storage and create a Docker Compose file where you specify a volume even if you have a single container. You then use the multi-container option and upload the YAML file.
Enable persistent storage by setting the application setting WEBSITES_ENABLE_APP_SERVICE_STORAGE = TRUE. You can do this from the portal or by using the CLI.
az webapp config appsettings set -g myResourceGroup -n <app-name> --settings WEBSITES_ENABLE_APP_SERVICE_STORAGE=TRUE
The ${WEBAPP_STORAGE_HOME} environment variable will point to the /home folder of the VM running your container. Use it to map the folder with a volume.
version: '3.3'
services:
wordpress:
image: myimage
volumes:
- ${WEBAPP_STORAGE_HOME}/site/wwwroot:/var/www/html
ports:
- "80:80"
restart: always