p:: gcloud Setup Firewall Rules PROJECT_ID=adithya321 gcloud compute \ --project=$PROJECT_ID \ firewall-rules delete default-allow-ssh { gcloud -q compute \ --project=$PROJECT_ID \ firewall-rules delete allow-all-ip gcloud -q compute \ --project=$PROJECT_ID \ firewall-rules delete allow-all-e PUBLIC_IP=`curl -s ipv4.icanhazip.com` gcloud -q compute \ --project=$PROJECT_ID \ firewall-rules create allow-all-ip \ --direction=INGRESS \ --priority=1000 \ --network=default \ --action=ALLOW \ --rules=all \ --source-ranges=$PUBLIC_IP gcloud -q compute \ --project=$PROJECT_ID \ firewall-rules create allow-all-e \ --direction=EGRESS \ --priority=1000 \ --network=default \ --action=ALLOW \ --rules=all \ --destination-ranges=$PUBLIC_IP } docker PROJECT_ID=adithya321 docker run --rm --volumes-from \ gcloud-config gcr.io/google.com/cloudsdktool/cloud-sdk \ gcloud compute \ --project=$PROJECT_ID \ firewall-rules delete default-allow-ssh The following firewalls will be deleted: - [default-allow-ssh] Do you want to continue (Y/n)? Y Deleted [https://www.googleapis.com/compute/v1/projects/adithya321/global/firewalls/default-allow-ssh]. PROJECT_ID=adithya321 { docker run --rm --volumes-from \ gcloud-config gcr.io/google.com/cloudsdktool/cloud-sdk \ gcloud -q compute \ --project=$PROJECT_ID \ firewall-rules delete allow-all-ip docker run --rm --volumes-from \ gcloud-config gcr.io/google.com/cloudsdktool/cloud-sdk \ gcloud -q compute \ --project=$PROJECT_ID \ firewall-rules delete allow-all-e PUBLIC_IP=`curl -s ipv4.icanhazip.com` docker run --rm --volumes-from \ gcloud-config gcr.io/google.com/cloudsdktool/cloud-sdk \ gcloud compute \ --project=$PROJECT_ID \ firewall-rules create allow-all-ip \ --direction=INGRESS \ --priority=1000 \ --network=default \ --action=ALLOW \ --rules=all \ --source-ranges=$PUBLIC_IP docker run --rm --volumes-from \ gcloud-config gcr.io/google.com/cloudsdktool/cloud-sdk \ gcloud compute \ --project=$PROJECT_ID \ firewall-rules create allow-all-e \ --direction=EGRESS \ --priority=1000 \ --network=default \ --action=ALLOW \ --rules=all \ --destination-ranges=$PUBLIC_IP } The following firewalls will be deleted: - [allow-all-ip] Do you want to continue (Y/n)? Deleted [https://www.googleapis.com/compute/v1/projects/adithya321/global/firewalls/allow-all-ip]. The following firewalls will be deleted: - [allow-all-e] Do you want to continue (Y/n)? Deleted [https://www.googleapis.com/compute/v1/projects/adithya321/global/firewalls/allow-all-e]. Creating firewall... ..Created [https://www.googleapis.com/compute/v1/projects/adithya321/global/firewalls/allow-all-ip]. NAME NETWORK DIRECTION PRIORITY ALLOW DENY DISABLED allow-all-ip default INGRESS 1000 all False done. Creating firewall... ..Created [https://www.googleapis.com/compute/v1/projects/adithya321/global/firewalls/allow-all-e]. NAME NETWORK DIRECTION PRIORITY ALLOW DENY DISABLED allow-all-e default EGRESS 1000 all False done.