Dockerized R 包找不到 "hiden" Google Cloud SDK 安装
Dockerized R package don't find "hiden" Google Cloud SDK installation
我没有在 WLS2 的 docker 化 R 包 (https://sen2r.ranghetti.info/articles/docker.html) 中找到 Google Cloud SDK 安装。
在我的 WLS2 控制台中,gcloud
已安装并处于活动状态:
asantos@ASANTOS-DELL:~$ gcloud config configurations list
NAME IS_ACTIVE ACCOUNT PROJECT COMPUTE_DEFAULT_ZONE COMPUTE_DEFAULT_REGION
default True xxxx@gmail.com xxxxx-client-323918
asantos@ASANTOS-DELL:~$ pwd
/home/asantos
asantos@ASANTOS-DELL:~/.config$ ls
R earthengine gcloud htop matplotlib rstudio
asantos@ASANTOS-DELL:~/.config$
但我尝试使用目录(/home/asantos
)运行docker,结果gcloud
在\wsl.localhost\Ubuntu-20.04\home\asantos\.config\gcloud
:
docker run --rm -e PASSWORD=sen2r -e USERID=$(id -u) -v $(pwd):/home/asantos -p 8777:8787 ranghetti/sen2r
Rstudio 内部:
我的输出总是:
Searching for a valid Google Cloud SDK installation...
Error:
Google Cloud SDK was not found; press install it following the instructions at
https://cloud.google.com/sdk/docs/install or set an existing installation using function check_gcloud()
(eventually specifying the argument 'gsutil_dir' if the automatic check would fail).
In addition: Warning message:
In normalizePath(path, ...) : path[1]="": No such file or directory
请问有什么帮助吗?
您有两个问题 - 首先,您没有在容器内安装 gcloud 命令行工具。其次,容器中没有显示 ~/.config/gcloud 目录。
您可以通过编写如下 Dockerfile 来安装 gcloud 工具:
FROM ranghetti/sen2r:latest
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-transport-https ca-certificates gnupg \
&& apt-get clean autoclean
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list \
&& curl -fSs https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - \
&& apt-get update \
&& apt-get install google-cloud-sdk
这几乎是从关于如何在 Debian 上安装 gcloud 的 Google SDK 文档中复制的。 (您使用的映像基于 Debian。)
获得 Dockerfile 后,您可以使用此命令构建它:
docker build . -t sen2r-plus-gcloud
构建完成后,您可以在之前使用 ranghetti/sen2r
的地方替换新的图像名称 sen2r-plus-gcloud
。
关于第二个问题,config目录没有出现,不知道是什么原因造成的第二个问题
我没有在 WLS2 的 docker 化 R 包 (https://sen2r.ranghetti.info/articles/docker.html) 中找到 Google Cloud SDK 安装。
在我的 WLS2 控制台中,gcloud
已安装并处于活动状态:
asantos@ASANTOS-DELL:~$ gcloud config configurations list
NAME IS_ACTIVE ACCOUNT PROJECT COMPUTE_DEFAULT_ZONE COMPUTE_DEFAULT_REGION
default True xxxx@gmail.com xxxxx-client-323918
asantos@ASANTOS-DELL:~$ pwd
/home/asantos
asantos@ASANTOS-DELL:~/.config$ ls
R earthengine gcloud htop matplotlib rstudio
asantos@ASANTOS-DELL:~/.config$
但我尝试使用目录(/home/asantos
)运行docker,结果gcloud
在\wsl.localhost\Ubuntu-20.04\home\asantos\.config\gcloud
:
docker run --rm -e PASSWORD=sen2r -e USERID=$(id -u) -v $(pwd):/home/asantos -p 8777:8787 ranghetti/sen2r
Rstudio 内部:
我的输出总是:
Searching for a valid Google Cloud SDK installation...
Error:
Google Cloud SDK was not found; press install it following the instructions at
https://cloud.google.com/sdk/docs/install or set an existing installation using function check_gcloud()
(eventually specifying the argument 'gsutil_dir' if the automatic check would fail).
In addition: Warning message:
In normalizePath(path, ...) : path[1]="": No such file or directory
请问有什么帮助吗?
您有两个问题 - 首先,您没有在容器内安装 gcloud 命令行工具。其次,容器中没有显示 ~/.config/gcloud 目录。
您可以通过编写如下 Dockerfile 来安装 gcloud 工具:
FROM ranghetti/sen2r:latest
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-transport-https ca-certificates gnupg \
&& apt-get clean autoclean
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list \
&& curl -fSs https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - \
&& apt-get update \
&& apt-get install google-cloud-sdk
这几乎是从关于如何在 Debian 上安装 gcloud 的 Google SDK 文档中复制的。 (您使用的映像基于 Debian。)
获得 Dockerfile 后,您可以使用此命令构建它:
docker build . -t sen2r-plus-gcloud
构建完成后,您可以在之前使用 ranghetti/sen2r
的地方替换新的图像名称 sen2r-plus-gcloud
。
关于第二个问题,config目录没有出现,不知道是什么原因造成的第二个问题