JupyterLab is a web-based interactive development environment for working with data, code, and visualization. Azure App Service is a platform for hosting web applications in the cloud. In this blog post, we will discuss how to deploy JupyterLab to Azure App Service using the official Docker image in Docker Hub.
To deploy JupyterLab to Azure App Service, we will use the Docker image jupyter/scipy-notebook hosted in Docker Hub, which contains JupyterLab and all its dependencies.
1. First, create an Azure App Service. To do this, go to the Azure portal, select "App Services," and click "Add" to create an app service. Make sure to select "Docker Container" as the publish option and "Linux" as the operating system.
2. Click “Next: Docker” and select "Docker Hub" as the image source. For the image and tag, specify "jupyter/scipy-notebook:latest".
3. Click the "Review and create" button to review the settings, and then click the "Create" button.
After creating the App Service, we need to configure it to view the application token and mount the file share.
1. Enable logs for Azure App Service by following these steps:
2. To persist the Jupyter notebooks you create in the JupyterLab, you need to mount a file share. To mount a file share, follow these steps:
Click "Save" to save your changes.
After restarting the App Service, browse the app service site. However, you should see JupyterLab asking for a token to enter.
To find the token, go to the “Log Stream” in the left blade and you should find it hidden there:
Your App Service may fail to start, and you may find the following error in the log stream:
RuntimeError: Permissions assignment failed for secure file: '/home/jovyan/.local/share/jupyter/runtime/jpserver-6.json'. Got '0o677' instead of '0o0600'.
This issue occurs because Jupyter checks the permission of the jpserver-6.json file. If it fails to meet the permission requirement, it will throw an error. For more information, please check this document.
To workaround this, add an application setting JUPYTER_ALLOW_INSECURE_WRITES in the App Service and give it a value of 1.
Enjoy playing with JupyterLab in Azure App Service!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.