Installing the Cloud SDK Docker image

The Cloud SDK Docker Image is essentially Cloud SDK installed on top of a Debian-based OS image.

This allows you to pull your desired version of Cloud SDK as a Docker image from Google Container Registry and quickly execute gcloud commands within an isolated, correctly configured container.

The Docker image itself is hosted on Container Registry, with the following repository name:

Docker image options

The Cloud SDK Docker images comes in three flavors; 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. Verify the installation (if you've pulled the latest version) by running:

    docker run --rm gcloud version

    Alternatively, run this command for a specific version, 266.0.0:

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

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

    Once 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 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> .