Docker“无效参考格式”错误设置Google Earth Engine for Python

时间:2018-02-25 21:20:43

标签: docker installation google-earth-engine

我一直在遵循Google的这些说明,使用Docker https://developers.google.com/earth-engine/python_install-datalab-local在我的本地计算机上创建和运行自定义Datalab容器

因为我使用的是Windows 10 Home(而不是Pro),所以我安装了适用于Windows的Docker Toolbox,并使用了Docker Quickstart终端。

一切进展顺利,'docker run hello-world'命令按预期运行。

不幸的是,当我从“第3步 - 创建容器”到达并运行命令时,我收到以下错误:

invalid reference format: repository name must be lowercase docker

我已经尝试了我可以在网上找到的所有解决方案,但似乎没有任何解决方案适用于Google Earth Engine和Docker的这个特定问题。

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

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/时,我得到'无法访问此网站 localhost拒绝连接。 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上找到的所有解决方案,但主要是为什么现在已停止工作了。

1 个答案:

答案 0 :(得分:0)

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

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地址表示您正在运行包含运行virtualbox的Linux VM的docker工具箱。这与基于HyperV的其他Docker for Windows安装有一些区别,包括VM作为不同的IP更加明显,并且您在quickstart终端中运行的命令使用的是bash shell。

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