gpt4 book ai didi

docker - gsutil:无法在 www.googleapis.com 找到服务器

转载 作者:行者123 更新时间:2023-12-02 18:16:08 25 4
gpt4 key购买 nike

Docker for Mac 1.12.3 给定这个 Dockerfile:

FROM debian:jessie
ENV DEBIAN_FRONTEND=noninteractive

RUN \
apt-get update && \
apt-get install --no-install-recommends --fix-missing -y -q \
ca-certificates \
curl \
python \
python-openssl \
&& \
apt-get clean autoclean && \
apt-get autoremove -y && \
rm -rf /var/lib/{apt,dpkg,cache,log}/

ENV GOOGLE_CLOUD_SDK=/google-cloud-sdk
ENV PATH=$PATH:$GOOGLE_CLOUD_SDK/bin
RUN \
export GOOGLE_SDK_URL=https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-134.0.0-linux-x86_64.tar.gz && \
mkdir $GOOGLE_CLOUD_SDK && \
curl --silent $GOOGLE_SDK_URL | tar xvzf - -C $GOOGLE_CLOUD_SDK --strip-components=1 && \
gcloud init

运行
docker build -t gsutil .

将产生
Welcome! This command will take you through the configuration of gcloud.

Your current configuration has been set to: [default]

You can skip diagnostics next time by using the following flag:
gcloud init --skip-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection..................done.
ERROR: Reachability Check failed.
Cannot reach https://cloudresourcemanager.googleapis.com/v1beta1/projects (ServerNotFoundError)
Cannot reach https://www.googleapis.com/auth/cloud-platform (ServerNotFoundError)
Cannot reach https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json (ServerNotFoundError)
Network connection problems may be due to proxy or firewall settings.


Do you have a network proxy you would like to set in gcloud (Y/n)?
Select the proxy type:
[1] HTTP
[2] HTTP_NO_TUNNEL
[3] SOCKS4
[4] SOCKS5
Please enter your numeric choice:
ERROR: Network diagnostic (0/1 checks) failed.

Network errors detected.

Would you like to continue anyways (y/N)?
You can re-run diagnostics with the following command:
gcloud info --run-diagnostics

这里提出了一些修复 https://code.google.com/p/google-cloud-sdk/issues/detail?can=2&q=&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Stars%20Summary%20log&groupby=&sort=&id=1146像:
gcloud config set custom_ca_certs_file /etc/ssl/certs/ca-certificates.crt

修复了 gcloud init失败,但是当我尝试使用 gsutil 对我的任何存储桶进行操作时我得到:
DEBUG 1115 20:39:17.746218 http_wrapper.py] Caught server not found error, retrying: Unable to find the server at www.googleapis.com

我的认证方式是 activate-service-account使用如下 JSON 键:
COPY ./mykey.json ./mykey.json
RUN gcloud auth activate-service-account --key-file=mykey.json

任何想法如何解决这一问题?

- 更新 -

我从 dockerfile 备份了一个图像并将其推送到 Docker Hub。要重现问题,请下载 GS key 并将其重命名为 key.json并运行:
docker run -it --rm -v $(pwd)/key.json:/key.json kilianciuffolo/gsutil bash
root@905045dd14eb:/# gcloud auth activate-service-account --key-file=/key.json && gsutil -D ls gs://my-test-bucket

最佳答案

我找到了解决办法!

在我的撰写文件中,我使用:dns: 8.8.8.8它现在完美无缺。

奇怪的是,在我的主机 macOS 10.12.1 和 Docker for Mac 0.12.3 上,我已经在使用 Google DNS。

可能是 Docker 网络/DNS 中的错误?

关于docker - gsutil:无法在 www.googleapis.com 找到服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40619337/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com