Create an instance using a custom container
This page describes how to create a Vertex AI Workbench instance based on a custom container.
Overview
Vertex AI Workbench instances support using a custom container derived from a Google-provided base container. You can modify this base container to make a custom container image and use this custom container to create a Vertex AI Workbench instance.
The base container is configured with a Container-Optimized OS in the host virtual machine (VM). The base container provides pre-installed data science packages and specific configurations that enable your instance to integrate with Google Cloud.
The base container is located at
gcr.io/deeplearning-platform-release/workbench-container:latest
.
Limitations
Consider the following limitations when planning your project:
The custom container must be derived from the Google-provided base container (
gcr.io/deeplearning-platform-release/workbench-container:latest
). Using a container that isn't derived from the base container isn't supported and increases the risks of compatibility issues with our services.Use of more than one container with a Vertex AI Workbench instance isn't supported.
Supported metadata for custom containers from user-managed notebooks and managed notebooks can have different behavior when used with Vertex AI Workbench instances.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Notebooks API.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Notebooks API.
Required roles
To ensure that your user account has the necessary
permissions to create a Vertex AI Workbench instance,
ask your administrator to grant your user account the
Notebooks Runner (roles/notebooks.runner
) IAM role on the project.
For more information about granting roles, see Manage access.
Your administrator might also be able to give your user account the required permissions through custom roles or other predefined roles.
Create a custom container
To create a custom container for use with Vertex AI Workbench instances:
Create a derivative container derived from the Google-provided base container image (
gcr.io/deeplearning-platform-release/workbench-container:latest
).Build and push the container to Artifact Registry. You'll use the container's URI when you create your Vertex AI Workbench instance. For example, the URI might look like this:
gcr.io/PROJECT_ID/IMAGE_NAME
.
Create the instance
You can create a Vertex AI Workbench instance based on a custom container by using the gcloud CLI.
Before using any of the command data below, make the following replacements:
-
INSTANCE_NAME
: the name of your Vertex AI Workbench instance; must start with a letter followed by up to 62 lowercase letters, numbers, or hyphens (-), and cannot end with a hyphen PROJECT_ID
: your project IDLOCATION
: the zone where you want your instance to be located-
CUSTOM_CONTAINER_PATH
: the path to the container image repository, for example:gcr.io/PROJECT_ID/IMAGE_NAME
-
METADATA
: custom metadata to apply to this instance; for example, to specify a post-startup-script, you can use thepost-startup-script
metadata tag, in the format:"--metadata=post-startup-script=gs://BUCKET_NAME/hello.sh"
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud workbench instances create INSTANCE_NAME \ --project=PROJECT_ID \ --location=LOCATION \ --container-repository=CUSTOM_CONTAINER_URL \ --container-tag=latest \ --metadata=METADATA
Windows (PowerShell)
gcloud workbench instances create INSTANCE_NAME ` --project=PROJECT_ID ` --location=LOCATION ` --container-repository=CUSTOM_CONTAINER_URL ` --container-tag=latest ` --metadata=METADATA
Windows (cmd.exe)
gcloud workbench instances create INSTANCE_NAME ^ --project=PROJECT_ID ^ --location=LOCATION ^ --container-repository=CUSTOM_CONTAINER_URL ^ --container-tag=latest ^ --metadata=METADATA
For more information about the command for creating an instance from the command line, see the gcloud CLI documentation.
Access your instance
You can access your instance through a proxy URL.
After your instance has been created and is active, you can get the proxy URL by using the gcloud CLI.
Before using any of the command data below, make the following replacements:
-
INSTANCE_NAME
: the name of your Vertex AI Workbench instance PROJECT_ID
: your project IDLOCATION
: the zone where your instance is located
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud workbench instances describe INSTANCE_NAME \ --project=PROJECT_ID \ --location=LOCATION | grep proxy-url
Windows (PowerShell)
gcloud workbench instances describe INSTANCE_NAME ` --project=PROJECT_ID ` --location=LOCATION | grep proxy-url
Windows (cmd.exe)
gcloud workbench instances describe INSTANCE_NAME ^ --project=PROJECT_ID ^ --location=LOCATION | grep proxy-url
proxy-url: 7109d1b0d5f850f-dot-datalab-vm-staging.googleusercontent.com
The describe
command returns your proxy URL. To access your
instance, open the proxy URL in a web browser.
For more information about the command for describing an instance from the command line, see the gcloud CLI documentation.