DEV Community

Yoshi Yamaguchi for Google Cloud

Posted on • Updated on

Easiest and fastest way to run Docker image on GCE

Shipping container fast

Because I'm in Developer Relations team, it is often the case where I want to run some Docker image exposed to public for tentative demo purpose, in such as codelab, workshop or hackathon events.

In those cases, I recommend to use Google Compute Engine because it has the feature to run Docker images on booting GCE instances.
Using the feature, you can run and make some service public in 2 commands. One is for firewall setting, the other is GCE instance creation.

For example, when you'd like to run Jaeger all-in-one image and make it public Jaeger endpoint, you can run the following commands:

$ gcloud compute firewall-rules create jaeger-rules \
    --allow udp:5775,udp:6831,udp:6832,tcp:5778,tcp:16686,tcp:14268,tcp:9411 \
    --direction ingress \
    --priority 1000 \
    --target-tags jaeger

$ gcloud compute instances create-with-container jaeger-vm \
    --container-image jaegertracing/all-in-one:1.14 \
    --boot-disk-size 30GB \
    --tags jaeger

Photo credit by https://www.marineinsight.com/guidelines/speed-of-a-ship-at-sea/

Top comments (0)