![](/img/trans.png)
[英]Automatically deploy new container to Google Cloud Compute Engine from Google Container Registry
[英]Cannot access Google Container Registry from Google Compute Engine
我正在嘗試將 Docker 映像從 Google Container Registry 獲取到 Google Compute Engine 實例上。 (我需要的圖片已經成功上傳到GCR。)
我已經使用gcloud auth login
,然后嘗試gcloud docker pull -- us.gcr.io/app-999/app
這導致ERROR: (gcloud.docker) Docker is not installed.
.
我嘗試使用oauth進行身份驗證並通過普通的 docker 調用進行拉取。 當我查看.docker/config.json
中的文件時,我會看到我的憑據。 這樣做,看起來它會起作用,但最終會像這樣結束:
mbname@instance-1 ~ $ docker pull -- us.gcr.io/app-999/app Using default tag: latest latest: Pulling from app-999/app b7f33cc0b48e: Pulling fs layer 43a564ae36a3: Pulling fs layer b294f0e7874b: Pulling fs layer eb34a236f836: Waiting error pulling image configuration: unauthorized: authentication required
這看起來像是進步,因為至少它試圖下載一些東西。
我也在我的本地機器上嘗試了這兩種方法,兩種方法都成功了。
我錯過了什么嗎?
謝謝你的幫助。
PS 我還嘗試從另一個注冊表(Docker Hub)加載一個容器,效果很好,但我需要多個容器,並希望降低費用。
聯系 Google 支持后,他們通知我gcloud
別名中存在錯誤。 這個錯誤是通過覆蓋 shell 中的別名來修復的,如下所示:
alias gcloud='(docker images google/cloud-sdk || docker pull google/cloud-sdk) > /dev/null;docker run -t -i --net=host -v $HOME/.config:/.config -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker google/cloud-sdk gcloud'
我已經試過了,現在可以用了。
docker
應包括在最新版本的gcloud
。 您可以通過運行gcloud components update
更新到最新版本的gcloud
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.