Search code examples
dockergoogle-cloud-platformgoogle-cloud-shell

Can't create GCP Cloud Shell custom image


I am trying to create a custom Cloud Shell image, as the defaul shell includes Terraform 0.12.9 and we are still on 0.11.14

I am following these instructions https://cloud.google.com/blog/products/devops-sre/gcp-devops-tricks-create-a-custom-cloud-shell-image-that-includes-terraform-and-helm using CLI

I created a Dockerfile with the version of Terraform I need.

Upon running docker build I get the follwing error message:

write /usr/share/dotnet/sdk/NuGetFallbackFolder/system.reflection.primitives/4.0.1/system.reflection.primitives.4.0.1.nupkg: no space left on device

Any ideas how to overcome?

For clarity I'm pasting the output of 'd -f'

d -f output


Solution

  • Rather than building a custom image, use the environment customization script that installs the packages you need on Cloud Shell startup.

    UPDATE:

    Here's an example for downgrading Terraform version:

    #!/bin/sh
    TERRAFORM_VERSION="0.11.14"
    curl https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip > terraform_${TERRAFORM_VERSION}_linux_amd64.zip
    unzip -o terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin
    

    Put this in ~/.customize_environment and don't forget to make that executable: chmod 755 ~/.customize_environment.