How install Cloud SDK Docker image from GCP?

🧰 Simple way to install SDK from GCP.

🔗Related content

You can find video related in:

📺YouTube

You can find repo related in:

🐱‍🏍GitHub

You can connect with me in:

🧬LinkedIn

Res…


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Lucas M. Ríos

🧰 Simple way to install SDK from GCP.

🔗Related content

You can find video related in:

📺YouTube

You can find repo related in:

🐱‍🏍GitHub

You can connect with me in:

🧬LinkedIn

Resume 🧾

I will install Docker image to use it as a SDK in Console GCP.

For more information and potential of this, click here.

1st - Pull Docker image ⬇

To use the image of the latest Cloud SDK release we will need pull image from repository in console.

I use following command:

CONSOLE:

docker pull gcr.io/google.com/cloudsdktool/cloud-sdk:latest

OUTPUT:

latest: Pulling from google.com/cloudsdktool/cloud-sdk
50e431f79093: Pull complete
6005b060ba7d: Pull complete
c49059196e30: Pull complete
Digest: sha256:fd9985597827057effdb04fd1b07db9463f4a00ac24684cd3726c05e146eafa1
Status: Downloaded newer image for gcr.io/google.com/cloudsdktool/cloud-sdk:latest
gcr.io/google.com/cloudsdktool/cloud-sdk:latest

2nd - Verifying installation ✅

Verify the installation (if you've pulled the latest version) by running the following command:

CONSOLE:

docker run gcr.io/google.com/cloudsdktool/cloud-sdk:latest gcloud version

OUTPUT:

Google Cloud SDK 284.0.0
alpha 2020.03.06
app-engine-go
app-engine-java 1.9.78
app-engine-python 1.9.88
app-engine-python-extras 1.9.88
beta 2020.03.06
bigtable
bq 2.0.54
cbt
cloud-datastore-emulator 2.1.0
core 2020.03.06
datalab 20190610
gsutil 4.48
kubectl 2020.03.06
pubsub-emulator 0.1.0

3rd - Authenticate with the gcloud 👤

We need authenticate to use gcloud tools. We can do that by the following command:

CONSOLE:

docker run -ti --name gcloud-config gcr.io/google.com/cloudsdktool/cloud-sdk gcloud auth login

Note: Once we've authenticated successfully, credentials are preserved in the volume of the gcloud-config container.

OUTPUT:

Go to the following link in your browser:

    https://accounts.google.com/o/oauth2/auth?...


Enter verification code: ********

You are now logged in as [xlmriosx@gmail.com].
Your current project is [xlmriosx].  You can change this setting by running:
  $ gcloud config set project PROJECT_ID

4th - Creating an alias 🔤

For simplicty create an alias by running:

CONSOLE:

alias csdk='docker run --rm --volumes-from gcloud-config -v ~/:/home/shared gcr.io/google.com/cloudsdktool/cloud-sdk'

You can change if you want. In my case I prefer 'csdk' like a nice alias.

5th - List your projects 📄

We can list projects by two forms a large and a short.

Large:
CONSOLE:

docker run --rm --volumes-from gcloud-config gcr.io/google.com/cloudsdktool/cloud-sdk gcloud projects list

Short:
CONSOLE:

csdk gcloud projects list

OUTPUT:

PROJECT_ID              NAME              PROJECT_NUMBER
xlmriosx                xlmriosx          783709003945

6th - Prove change of a project 🔀

We can change name of projects by two ways a large and a short.

Large:
CONSOLE:

docker run --rm --volumes-from gcloud-config gcr.io/google.com/cloudsdktool/cloud-sdk gcloud config set project $PROJECT_NAME

Short:
CONSOLE:

csdk gcloud config set project $PROJECT_NAME

OUTPUT:

Updated property [core/project].

7th - Say thanks, give like and share if this has been of help/interest 😁🖖


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Lucas M. Ríos


Print Share Comment Cite Upload Translate Updates
APA

Lucas M. Ríos | Sciencx (2023-01-31T23:57:19+00:00) How install Cloud SDK Docker image from GCP?. Retrieved from https://www.scien.cx/2023/01/31/how-install-cloud-sdk-docker-image-from-gcp/

MLA
" » How install Cloud SDK Docker image from GCP?." Lucas M. Ríos | Sciencx - Tuesday January 31, 2023, https://www.scien.cx/2023/01/31/how-install-cloud-sdk-docker-image-from-gcp/
HARVARD
Lucas M. Ríos | Sciencx Tuesday January 31, 2023 » How install Cloud SDK Docker image from GCP?., viewed ,<https://www.scien.cx/2023/01/31/how-install-cloud-sdk-docker-image-from-gcp/>
VANCOUVER
Lucas M. Ríos | Sciencx - » How install Cloud SDK Docker image from GCP?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/01/31/how-install-cloud-sdk-docker-image-from-gcp/
CHICAGO
" » How install Cloud SDK Docker image from GCP?." Lucas M. Ríos | Sciencx - Accessed . https://www.scien.cx/2023/01/31/how-install-cloud-sdk-docker-image-from-gcp/
IEEE
" » How install Cloud SDK Docker image from GCP?." Lucas M. Ríos | Sciencx [Online]. Available: https://www.scien.cx/2023/01/31/how-install-cloud-sdk-docker-image-from-gcp/. [Accessed: ]
rf:citation
» How install Cloud SDK Docker image from GCP? | Lucas M. Ríos | Sciencx | https://www.scien.cx/2023/01/31/how-install-cloud-sdk-docker-image-from-gcp/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.