Docker "invalid reference format" 为 Python 设置 Google Earth Engine 时出错

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

我一直在按照 Google 中的这些说明使用 Docker https://developers.google.com/earth-engine/python_install-datalab-local

在我的本地计算机上创建和 运行 自定义 Datalab 容器

因为我使用的是 Windows 10 Home(而不是专业版),所以我已经为 Windows 安装了 Docker 工具箱,并且正在使用 Docker 快速启动终端.

一切顺利,'docker run hello-world' 命令 运行 符合预期。

不幸的是,当我到达 运行 来自 'Step 3 - Create a container' 的命令时,我收到以下错误:

invalid reference format: repository name must be lowercase docker

我已经尝试了所有可以在网上找到的解决方案,但是 none 似乎是针对 Google Earth Engine 和 Docker.[=21= 的这个特定问题]

我运行导致错误的那一行如下:

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

提前感谢您提供的任何建议。

更新 - 运行 使用 linux 指令代替命令(感谢 BMitch 的建议)我观察到以下内容:

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.

不幸的是,当我打开浏览器并将其指向 http://localhost:8081/ 时,我得到“无法访问此站点” 本地主机拒绝连接。 ERR_CONNECTION_REFUSED'

3 月 3 日:好消息 - 我使用默认机器 IP 结合 VM IP 如下: http://192.168.99.100:8080 现在我在数据实验室。

3 月 9 日:坏消息 - 我今晚再次尝试使用 Docker 并按照完全相同的步骤进行设置,直到我尝试将浏览器定向到 http://192.168.99.100:8080 并且我我收到 Chrome 页面,上面写着无法访问此站点和 ERR_CONNECTION_REFUSED。我已经用 Google 尝试了我能找到的每一个修复方法,但我很困惑为什么它现在停止工作了。

当 docker 客户端试图解析您正在 运行 的图像时,会发生 invalid reference format 错误。该图像是命令的第一部分,它不是 docker run 的有效参数,因此可以传递一个带有 space 的参数,该参数未被引用(与卷相同)。在您的情况下,引用了音量和环境变量:

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

所以下一步是 运行 上面的同一行,前面有一个 echo 以确保变量正在扩展。只有 windows 命令或电源 shell.

才会发生这种情况

"docker quickstart terminal" 和“192.168.99.100”IP 地址表示您正在 运行ning docker 包含 Linux VM 运行 虚拟机的工具箱。这与基于 HyperV 的其他 Docker for Windows 安装有一些不同,包括 VM 作为不同的 IP 更可见,以及您在快速启动终端中 运行ning 的命令正在使用 bash shell。

因此,您需要使用具有 $CONTAINER_IMAGE_NAME 而不是 windows %CONTAINER_IMAGE_NAME% 语法的命令的 Linux/Bash 变体。您还需要使用 VM IP 连接到您的容器。当您查看快速启动终端时,您会看到定义了一些变量,包括 DOCKER_HOST,它们会导致客户端连接到 VM 中的 docker 主机。