Search code examples
gcp-ai-platform-notebook

How can I force docker pull from custom images for Google AI Platform Notebooks?


I'm creating custom docker images for Google AI Platform Notebooks as documented in https://cloud.google.com/ai-platform/notebooks/docs/custom-container

But I can't find out how to update this docker image in the instance once it's created.


Solution

  • You can do it using the metadata. Just to provide an example, create a Notebook instance from UI, or also from CLI:

    gcloud compute instances create nb-container-1 \
     --image-project=deeplearning-platform-release \
     --image-family=common-container-notebooks \
     --machine-type=n1-standard-1 \
     --accelerator type=nvidia-tesla-t4,count=1 \
     --maintenance-policy TERMINATE \
     --metadata="proxy-mode=project_editors,install-nvidia-driver=True,container=gcr.io/deeplearning-platform-release/base-cu101:m49" \
     --boot-disk-size 200GB \
     --scopes=https://www.googleapis.com/auth/cloud-platform \
     --zone=asia-southeast1-b
    

    or

    gcloud beta notebooks instances create nb-container-2 \
    '--machine-type=n1-standard-1' \
    '--container-repository=gcr.io/deeplearning-platform-release/base-cu101' \
    '--container-tag=m49' \
    '--accelerator-type=NVIDIA_TESLA_T4' \
    '--accelerator-core-count=1' \
    --install-gpu-driver \
    '--location=europe-west3-a'
    

    Once instance is created you can do the following:

    1. Stop instance
    2. Edit metadata to latest tag:
    container=gcr.io/deeplearning-platform-release/base-cu101:latest
    
    1. Start instance