google/cloud-sdk
is a Docker image bundling all the components and dependencies of the Google Cloud SDK including alpha and beta components.
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 init
# 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 gcloud info
$ 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 gcutil listinstances
$ docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk gsutil ls
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 gcloud info
$ docker run --rm -ti google/cloud-sdk gcloud components list
$ docker run --rm -ti google/cloud-sdk gcutil listinstances
$ docker run --rm -ti google/cloud-sdk gsutil ls