Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install the Google Cloud SDK in a Docker Image?

How can I build a Docker container with Google's Cloud Command Line Tool/SDK?

The script at the url https://sdk.cloud.google.com appears to require user input so doesn't work in a docker file.

like image 642
Jeremy Avatar asked Feb 06 '15 18:02

Jeremy


People also ask

How do I know if gcloud SDK is installed?

The first thing to do after successful installation is open your command line and type “gcloud” to check whether Cloud SDK has installed perfectly. Run “gcloud init”, it opens up a new browser window and asks to login into your google cloud account.


1 Answers

Adding the following to my Docker file appears to work.

# Downloading gcloud package RUN curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz > /tmp/google-cloud-sdk.tar.gz  # Installing the package RUN mkdir -p /usr/local/gcloud \   && tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz \   && /usr/local/gcloud/google-cloud-sdk/install.sh  # Adding the package path to local ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin 
like image 107
Jeremy Avatar answered Sep 19 '22 16:09

Jeremy