google/cloud-sdk
is a Docker image bundling all the components and dependencies
of the Google Cloud SDK:
- App Engine SDK for Go
- App Engine SDK for Java
- App Engine SDK for Python and PHP
- Big Query Command Line Tool
- Cloud DNS Admin Command Line Interface
- Cloud SQL Admin Command Line Interface
- Cloud Storage Command Line Tool
- Compute Engine Command Line Tool
- Preview Command Line Tools
Follow these instructions if you are running docker outside of Google Compute Engine:
# get the cloud sdk image
$ docker pull google/cloud-sdk
# auth & save the credentials in gcloud-config volumes
$ docker run -t -i --name gcloud-config google/cloud-sdk gcloud auth login
Go to the following link in your browser: ...
Enter verification code: ...
You are now logged in as [...]
Your current project is [None]. You can change this setting by running:
$ gcloud config set project <project>
gcloud config set project ...
# If you would like to use service account instead please look here:
$ docker run -t -i --name gcloud-config google/cloud-sdk gcloud auth activate-service-account <your-service-account-email> --key-file /tmp/your-key.p12 --project <your-project-id>
# re-use the credentials from gcloud-config volumes & run sdk commands
$ docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk gcutil listinstances
$ docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk gsutil ls
$ docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk gcloud components list
$ docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk gcloud version
If you are using this image from within Google Compute Engine. If you enable a Service Account with the necessary scopes, there is no need to auth or use a config volume:
# get the cloud sdk image
$ docker pull google/cloud-sdk
# just start using the sdk commands
$ docker run --rm -ti google/cloud-sdk gcutil listinstances
$ docker run --rm -ti google/cloud-sdk gsutil ls
$ docker run --rm -ti google/cloud-sdk gcloud components list
$ docker run --rm -ti google/cloud-sdk gcloud version