Skip to content

Instantly share code, notes, and snippets.

@mccutchen
Created March 31, 2022 21:22
Show Gist options
  • Save mccutchen/ace7cc85bb6ec7d846946c77b4e41916 to your computer and use it in GitHub Desktop.
Save mccutchen/ace7cc85bb6ec7d846946c77b4e41916 to your computer and use it in GitHub Desktop.
gcloud — a wrapper that executes the gcloud CLI in a docker container, to avoid requiring a local installation.
#!/bin/bash
#
# A wrapper that executes the gcloud CLI in a docker container, to avoid
# requiring a local installation.
#
# Adapted from this helpful blog post:
# https://blog.scottlowe.org/2018/09/13/running-gcloud-cli-in-a-docker-container/
GCLOUD_SDK_TAG="312.0.0"
exec docker run \
--rm -it \
--workdir /code \
-v $PWD:/code \
-v $HOME/.config/gcloud:/root/.config/gcloud \
google/cloud-sdk:$GCLOUD_SDK_TAG \
gcloud $*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment