dockergoogle-cloud-platformjupytergcp-ai-platform-notebook

How to install a custom container with latest Python + JupyterLab version?


How to create a custom Docker container to use with Google Workbench and connect to Proxy?

Create the following Dockerfile

FROM python:3.11.3-bullseye

# Install JupyterLab and any other required packages
RUN pip install jupyter -U && pip install jupyterlab

# Expose the JupyterLab port
EXPOSE 8080

ENV pwd=""

ENTRYPOINT exec jupyter-lab --no-browser --ip=0.0.0.0 --port=8080  --port-retries=0 --allow-root --NotebookApp.token="$pwd" --NotebookApp.password="$pwd" --ServerApp.allow_origin="*" --ServerApp.root_dir="/home/jupyter" --ServerApp.allow_origin_pat="(https?://)?[0-9a-z]+-dot-[\-0-9a-z]*\.notebooks\.googleusercontent\.com"  --ServerApp.disable_check_xsrf=True  --ServerApp.allow_remote_access=True

  1. Build and push container
PROJECT_ID=""
CONTAINER_NAME
CONTAINER_URL=gcr.io/${PROJECT?}/${CONTAINER_NAME?}:dev`


docker build -t ${CONTAINER_URL} .
docker push ${CONTAINER_URL}
  1. Create a new User Managed Notebook with a Custom container using ${CONTAINER_URL}

Solution

  • Just as a reference, this post answers the question submitted here where a policy organization does not allow external internet access, limiting package installation and/or using different Python verions in Vertex AI.