Deploy a Container on GCE from shell

Stefano Ballerini
1 min readMay 16, 2019

--

Before deploying the container a firewall rule is applied to allow http traffic on port 80

$ gcloud compute firewall-rules create allow-http --target-tags http-server --allow tcp:80

Now deploy the container

$ gcloud beta compute instances create-with-container nginx-container --tags http-server --cointainer-image nginx:alpine

Tags are used to associate the container to the firewall rule

Test it!

$ curl -i <EXTERNAL-IP>

--

--