If you develop or manage apps on Google Cloud Platform(GCP), you’re probably familiar with Cloud Shell, which provides you with a secure CLI that you can use to manage your environment directly from the browser. But while Cloud Shell’s default image contains most of the tools you could wish for, in some cases you might need more—for example, Terraform for infrastructure provisioning, or Helm, the Kubernetes package manager. In this blog post, you will learn how to create a custom Docker image for Cloud Shell that includes the Helm client and Terraform. At a high level, this is a two-step process:Create and publish a Docker imageConfigure your custom image to be used in Cloud ShellLet’s take a closer look. 1. Create and publish a custom Cloud Shell Docker imageFirst, you need to create new Docker image that’s based on the default Cloud Shell image and then publish the image you created to Container Registry.1. Create a new repo and set the project ID where the Docker image should be published:2. With your file editor of choice, create a file named Dockerfile with the following content:3. Build the Docker image:4. Push the Docker image to Container Registry:Note: You will need to configure Docker to authenticate with gcr by following the steps here.2. Configure Cloud Shell image to use the published imageNow that you’ve created and published your image, you need to configure the Cloud Shell Environment to utilize the image that was published to Container Registry. In the Cloud Console follow these steps:Go to Cloud Shell Environment settingsClick EditClick “Select image from project”In the Image URL field enter: gcr.io/$GCP_PROJECT_ID/cloud-shell-image:latestClick “Save”Now open a new Cloud Shell session and you should see that the new custom image is used.There you have it—a way to configure your Cloud Shell environment with all your favorite tools. To learn more about Cloud Shell, check out the documentation.
Quelle: Google Cloud Platform
Published by