An Azure machine learning service for building and deploying models.
Hi,
This PermissionError: [Errno 13] occurs because Azure ML v2 pipeline runners mount the container runtime directory /mnt/azureml/cr/ with root ownership, while custom Dockerfiles using non-root USER directives lack write permissions to mounted paths.
Here is how to resolve it:
- Grant Permissions in Dockerfile: Pre-create and grant write access to the mount path in your custom Dockerfile before switching users:
RUN mkdir -p /mnt/azureml && chmod -R 777 /mnt/azureml - Redirect MLflow Temp Directory: In your Python script, redirect MLflow's local staging directory to
/tmpbefore callingmlflow.pytorch.log_model():import os os.environ["MLFLOW_TMP_DIR"] = "/tmp/mlflow" - Avoid Restrictive Non-Root Users: Ensure your custom base image preserves default execution rights for Azure ML runtime mounts.
Ref: Create & Manage Custom Environments in Azure Machine Learning v2
If this helped resolve your issue, please mark as Accept Answer!