我使用 Ubuntu 18.10 在 GCP 上创建了一个虚拟机实例。当我在没有任何修改的情况下通过 SSH 连接虚拟机并尝试:
gcloud info
我收到一些警告:
System PATH: [/snap/google-cloud-sdk/66/usr/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/game
s:/snap/bin]
Python PATH: [/snap/google-cloud-sdk/66/lib/third_party:/snap/google-cloud-sdk/66/lib:/snap/google-cloud-sdk/66/usr/lib/python2.7/:/snap
/google-cloud-sdk/66/usr/lib/python2.7/plat-x86_64-linux-gnu:/snap/google-cloud-sdk/66/usr/lib/python2.7/lib-tk:/snap/google-cloud-sdk/6
6/usr/lib/python2.7/lib-old:/snap/google-cloud-sdk/66/usr/lib/python2.7/lib-dynload]
Cloud SDK on PATH: [False]
Kubectl on PATH: [False]
WARNING: There are old versions of the Google Cloud Platform tools on your system PATH.
/usr/bin/snap
如果我尝试使用以下方式进行身份验证:
sudo gcloud auth configure-docker
I see:
WARNING: `docker-credential-gcloud` not in system PATH.
gcloud's Docker credential helper can be configured but it will not work until this is corrected.
WARNING: `docker` not in the system PATH.
`docker` and `docker-credential-gcloud` need to be in same PATH in order to work correctly together.
gcloud's Docker credential helper can be configured but it will not work until this is corrected.
The following settings will be added to your Docker config file
似乎安装了最新版本的 gcloud:
sudo gcloud version
Google Cloud SDK 230.0.0
alpha 2019.01.11
beta 2019.01.11
bq 2.0.39
core 2019.01.11
gsutil 4.35
kubectl 2019.01.11
似乎不允许我在这种情况下更新 gcloud 。
然后我安装了 Docker 并提取了一个 docker 镜像。
sudo snap install docker
sudo docker pull tensorflow/serving
这工作正常。
问题是我无法将映像推送到 GCP Container Registry:
sudo docker tag tensorflow/serving gcr.io/xxx/tf-serving
sudo docker push gcr.io/xxx/tf-serving
Unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request
st, follow the steps in https://cloud.google.com/container-registry/docs/advanced-authentication
并在链接中解释说我需要运行:
sudo gcloud auth configure-docker
我该如何解决这个问题?当我通过 SSH 连接虚拟机时,问题已经存在吗?
WARNING: `docker-credential-gcloud` not in system PATH.
我可以毫无问题地将镜像推送到 DockerHub 上。
我尝试重新安装 google-cloud-sdk:
sudo apt-get update && sudo apt-get install google-cloud-sdk
但现在我需要使用:
sudo gcloud alpha auth configure-docker
最后我仍然无法推动图像。
这似乎与某些路径问题有关:
Cloud SDK on PATH: [False]
Kubectl on PATH: [False]
WARNING: There are old versions of the Google Cloud Platform tools on your system PATH.
/usr/bin/snap
任何想法?我确实按照 GCP 文档一步一步进行操作。我还查看 GCP IAM 以授予对我的存储桶的一些访问权限。
我是 GCP 和 Cloud 的新手,所以我可能错过了一些明显的东西。顺便说一句,我需要使用 shell 脚本构建 Docker 映像,因此我需要使用此类类型的 VM,因为在另一个已经预安装了很多内容的 VM 上安装了“noexec”标志。