Skip to content

Instantly share code, notes, and snippets.

@seandavi
Created January 4, 2022 03:30
Show Gist options
  • Save seandavi/fd061b6318bb6d2456dcc6f464390993 to your computer and use it in GitHub Desktop.
Save seandavi/fd061b6318bb6d2456dcc6f464390993 to your computer and use it in GitHub Desktop.
Start and stop an Rstudio-based container on GCP VM
#!/bin/bash
CONTAINER=ghcr.io/seandavi/buildabiocworkshop
ZONE=us-central1-a
PASSWORD=rstudio
INSTANCE=rs-2
gcloud compute instances create-with-container $INSTANCE \
--container-image $CONTAINER \
--container-env PASSWORD=$PASSWORD \
--tags rstudio
gcloud compute firewall-rules create allow-rstudio \
--allow tcp:8787 --target-tags rstudio
#!/bin/bash
CONTAINER=ghcr.io/seandavi/buildabiocworkshop
ZONE=us-central1-a
PASSWORD=rstudio
INSTANCE=rs-2
gcloud compute instances delete $INSTANCE --zone=$ZONE
gcloud compute firewall-rules delete allow-rstudio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment