Installing the Cloud SDK Docker image

The Cloud SDK Docker image lets you pull a specific version of Cloud SDK as a Docker image from Container Registry and quickly execute gcloud tool commands in an isolated, correctly configured container.

The Cloud SDK Docker image is Cloud SDK installed on top of a Debian-based OS image. The Docker image is hosted on Container Registry, with the following repository name:

Docker image options

The Cloud SDK Docker images comes in three versions; latest, slim, and alpine. You can specify your preference by using the appropriate tag after the host repository name:

  • :latest, :VERSION: Large (Debian-based) image with additional components pre-installed
  • :slim, :VERSION-slim: Smaller (Debian-based) image with no components pre-installed
  • :alpine, :VERSION-alpine: Smallest (Alpine-based) image with no additional components installed

Installing a specified Docker image

  1. To use the image of the latest Cloud SDK release,, pull it from Container Registry by running the following command:

    docker pull
  2. If you've pulled the latest version, verify the installation by running:

    docker run --rm gcloud version

    If you pulled a specific version, verify the installation by running a command similar to the following sample:

    docker run --rm gcloud version
  3. Authenticate with the gcloud tool by running:

    docker run -ti --name gcloud-config gcloud auth login

    After you've authenticated successfully, credentials are preserved in the volume of the gcloud-config container.

  4. List compute instances using these credentials to verify by running the container with --volumes-from:

    docker run --rm --volumes-from gcloud-config gcloud compute instances list --project your_project

Installing additional components

By default, the latest images ( and have all the gcloud tool components installed.

The and images, however, do not come with additional components pre-installed. You can extend these images by following the instructions below:

Debian-based images

To install an additional component, like google-cloud-sdk-datastore-emulator, run the following:

cd debian_slim/
docker build --build-arg CLOUD_SDK_VERSION=159.0.0 \
    --build-arg INSTALL_COMPONENTS="google-cloud-sdk-datastore-emulator" \
    -t my-cloud-sdk-docker:slim .

Alpine-based images

To install additional components for Alpine-based images, create a Dockerfile that uses the Cloud SDK image as the base image. For example, to add kubectl and app-engine-java components, create a Dockerfile to look like:

RUN apk --update add openjdk7-jre
RUN gcloud components install app-engine-java kubectl

Once done, run the following command:

docker build -t my-cloud-sdk-docker:alpine .

Installing specific versions of Cloud SDK

To install specific Cloud SDK versions, pass your preferred version in when running the docker build command, like so:

docker build -t my-cloud-sdk-docker:alpine --build-arg CLOUD_SDK_VERSION=<release_number> .