Search code examples
dockerinstallationgoogle-earth-engine

Docker "invalid reference format" error setting up Google Earth Engine for Python


I've been following these instructions from Google to create and run a custom Datalab container on my local computer using Docker https://developers.google.com/earth-engine/python_install-datalab-local

Because I'm using Windows 10 Home (and not Pro) I have installed the Docker Toolbox for Windows, and am using the Docker Quickstart Terminal.

All was going well, and the 'docker run hello-world' command ran as expected.

Unfortunately when I reach and run the command from 'Step 3 - Create a container' I get the following error:

invalid reference format: repository name must be lowercase docker

I've tried all of the solutions I can find online, but none seem to be for this specific issue with Google Earth Engine and Docker.

The line that I run which causes the error is as follows:

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

Thanks in advance for any advice you can give.

Update - having run the commands using the linux instructions instead (thanks to BMitch for suggestion) I have observed the following:

Joshua@joshuaslaptop MINGW64 ~/workspace/datalab-ee
$ docker run -it -p "127.0.0.1:8081:8080" -v "$WORKSPACE:/content" -e "PROJECT_
ID=$GCP_PROJECT_ID" $CONTAINER_IMAGE_NAME
Unable to find image 'gcr.io/earthengine-project/datalab-ee:latest' locally
latest: Pulling from earthengine-project/datalab-ee
d5c6f90da05d: Pulling fs layer
1300883d87d5: Pulling fs layer
c220aa3cfc1b: Pulling fs layer
2e9398f099dc: Pull complete
dc27a084064f: Pull complete
a9beee8825e8: Pull complete
820c4419b702: Pull complete
1e469a335c21: Pull complete
c5b0f426997a: Pull complete
9c420430911d: Pull complete
55b93740e75d: Pull complete
7529756a606c: Pull complete
32a65a2a0095: Pull complete
f1f4299b6d87: Pull complete
9b3af0c58fa7: Pull complete
25701950f728: Pull complete
02bef77e0652: Pull complete
bd0df1a3ab4b: Pull complete
0c8295055334: Pull complete
770ae3163899: Pull complete
ad91a1f8689d: Pull complete
5892df391041: Pull complete
b254f84d1e17: Pull complete
0b48033d0f70: Pull complete
363a2905e789: Pull complete
3e15c95c4f7f: Pull complete
6b68c1ba91f0: Pull complete
Digest: 
sha256:36c3348622914efc57267742114b44eb888c5093c52b11f082a8f36f3ad327d8
Status: Downloaded newer image for gcr.io/earthengine-project/datalab-ee:latest
Adding Earth Engine docs to the Datalab container...
Cloning into 'temp-repo'...
remote: Counting objects: 3844, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 3844 (delta 11), reused 25 (delta 11), pack-reused 3801
Receiving objects: 100% (3844/3844), 9.69 MiB | 1.56 MiB/s, done.
Resolving deltas: 100% (2369/2369), done.
Checking connectivity... done.
Checking out files: 100% (510/510), done.
Verifying that the /tmp directory is writable
The /tmp directory is writable
Cloning into 'docs'...
remote: Counting objects: 631, done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 631 (delta 72), reused 53 (delta 53), pack-reused 542
Receiving objects: 100% (631/631), 22.09 MiB | 1.41 MiB/s, done.
Resolving deltas: 100% (323/323), done.
Checking connectivity... done.
Checking out files: 100% (55/55), done.
Already on 'master'
Your branch is up-to-date with 'origin/master'.
Starting Datalab in silent mode, for debug output, rerun with an additional '-e DATALAB_DEBUG=true' argument
Open your browser to http://localhost:8081/ to connect to Datalab.

Unfortunately, when I open the my browser and point it at http://localhost:8081/ I get 'This site can’t be reached localhost refused to connect. ERR_CONNECTION_REFUSED'

3rd March: Good news - I used the default machine IP combined with the VM IP as follows: http://192.168.99.100:8080 Now I'm in the data lab.

9th March: Bad news - I've tried again tonight to use Docker and following the exact same steps the setup all went fine until I tried to direct my browser to http://192.168.99.100:8080 and I'm getting the Chrome page saying This site can’t be reached and ERR_CONNECTION_REFUSED. I've tried every fix I can find with Google, but majorly confused as to why this has now stopped working.


Solution

  • The invalid reference format error happens when the docker client tries to parse what image you are running. The image is the first part of the command that is not a valid argument to docker run, so that can be passing an argument with a space in it that wasn't quoted (common with volumes). In your case the volume and environment variable were quoted:

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

    So the next step was to run the same line above with an echo in front to be sure the variables were expanding. This would only happen with a windows command or power shell.

    The "docker quickstart terminal" and "192.168.99.100" ip address indicates you are running docker toolbox that includes a Linux VM running with virtualbox. This has a few differences from other Docker for Windows installs that are based on HyperV, including the VM being more visible as a different IP and the commands you are running in the quickstart terminal are using a bash shell.

    Therefore you need to use the Linux/Bash variant of commands that have a $CONTAINER_IMAGE_NAME rather than the windows %CONTAINER_IMAGE_NAME% syntax. You also need to connect to your container using the VM IP. When you look as your quickstart terminal, you'll see a few variables defined, including DOCKER_HOST, that cause the client to connect to the docker host in the VM.