gsutil:无法在www.googleapis.com上find服务器
在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 like:
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
我的身份validation方法是带有JSON密钥的activate-service-account
,如下所示:
COPY ./mykey.json ./mykey.json RUN gcloud auth activate-service-account --key-file=mykey.json
任何想法如何解决这一问题?
– 更新 –
我从dockerfile中支持一个镜像,并将其推送到Docker Hub。 要重现问题,请下载GS密钥并将其重命名为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。
可能是Dockernetworking/ DNS中的一个错误?