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

How does the data in HOME directory persist on cloud shell?


Do they use environment / config variables to link the persistent storage to the project related docker image ?

So that everytime new VM is assigned, the cloud shell image can be run with those user specific values ?


Solution

  • Not sure to have caught all your questions and concerns. So, Cloud Shell is in 2 parts:

    • The container that contains all the installed library, language support/sdk, binaries (docker for example). This container is stateless and you can change it (in the setting section of Cloud Shell) if you want to deploy a custom container. For example, it's what is done with Cloud Run Button for deploying a Cloud Run service automatically.

    • The volume dedicated to the current user that is mounted in the Cloud Shell container.

    By the way, you can easily deduce that all you store outside the /home/<user> directory is stateless and not persist. /tmp directory, docker image (pull or created),... all of these are lost when the Cloud Shell start on other VM.

    Only the volume dedicated to the user is statefull, and limited to 5Gb. It's linux environment and you can customize the .profile and .bash_rc files as you want. You can store keys in /.ssh/ directory and all the other tricks that you can do on Linux in your /home directory.