Python Installation - Datalab on local machine

Stay organized with collections Save and categorize content based on your preferences.


This page describes how to create and run a custom Datalab container on your local computer using Docker.

Step 1 - Install Docker

Install the Docker software by following the installation instructions on the Docker website.

Verify your Docker installation is working by opening up a command prompt (terminal) and running the following command:

docker run hello-world
If successful, you should get back a "Hello from Docker!" message with additional information on your Docker installation.

Step 2 - Define a Local Workspace

In a terminal window, run the following commands:

export WORKSPACE=${HOME}/workspace/datalab-ee
mkdir -p $WORKSPACE
set ""
set "WORKSPACE=%HOME%\workspace\datalab-ee"
mkdir "%WORKSPACE%"

Step 3 - Create a container

Create a Datalab+EE container by using the docker run command. The command attaches the local workspace to the container.

docker run -it -p "" -v "$WORKSPACE:/content" -e "PROJECT_ID=$GCP_PROJECT_ID" $CONTAINER_IMAGE_NAME

For troubleshooting issues, see Docker's Get started with Docker for Mac instructions.

docker run -it -p "" -v "%WORKSPACE%:/content" -e "PROJECT_ID=%GCP_PROJECT_ID%" %CONTAINER_IMAGE_NAME%

For troubleshooting issues, see Docker's Get started with Docker for Windows instructions.

Authenticating to Earth Engine

In order to successfully run code in Datalab that accesses Earth Engine, you first need to authenticate to Earth Engine. To authenticate from within Datalab, navigate to the /notebooks/docs-earthengine folder and open up the authorize_notebook_server.ipynb notebook. Follow the instructions within the notebook to create and store authentication credentials.

Note that your credentials are stored within your container instance, and will persist if you disconnect from your instance. However, if you delete/remove your Docker container and re-create it, you will need to re-authenticate.