I created a VM instance on GCP using Ubuntu 18.10. When I SSH the VM without any modification and try:
gcloud info
I got some Warning:
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
If I try to authenticate with:
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
It seems that a quite recent version of gcloud is installed:
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
It doesn't seem I am allowed to update gcloud on such instance.
Then I installed Docker and pulled a docker image.
sudo snap install docker
sudo docker pull tensorflow/serving
This is working fine. The issue is that I cannot push the image on 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
and in the link it is explained that I need to run:
sudo gcloud auth configure-docker
How do I fix the issue? The issue is already present when I SSH the VM ?
WARNING: `docker-credential-gcloud` not in system PATH.
I can push the image on DockerHub without any issue.
I tried to reinstall google-cloud-sdk:
sudo apt-get update && sudo apt-get install google-cloud-sdk
But now I need to use:
sudo gcloud alpha auth configure-docker
and the end I still cannot push the image.
It seems to be related to some path issue:
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
Any idea? I did follow the GCP documentation step by step. I also look at GCP IAM to grant some access on my bucket.
I am new on GCP and Cloud so I am probably missing something obvious. By the way, I need to build a Docker image using a shell script so I need to use such type of VM because on the other VM for which a lot of stuff is already pre-installed are mounted with "noexec" flag.
The Snap package contains docker-credential-gcloud
in /snap/google-cloud-sdk/current/bin/
. You can symlink it to /usr/local/bin
using:
sudo ln -s /snap/google-cloud-sdk/current/bin/docker-credential-gcloud /usr/local/bin
After that, pushing Docker images to Google Container Registry (gcr.io) works fine.
I also tried sudo snap alias google-cloud-sdk.docker-credential-gcloud docker-credential-gcloud
to create a symlink similar to the one for gcloud
itself. But that failed with the following error:
error: cannot perform the following tasks:
- Setup manual alias "docker-credential-gcloud" => "docker-credential-gcloud" for snap "google-cloud-sdk" (cannot enable alias "docker-credential-gcloud" for "google-cloud-sdk", target application "docker-credential-gcloud" does not exist)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With