Noob Learning
Published in

Noob Learning

⚙️ Hello Rust on CloudRun

There’s no official support for deploy and run Rust in Google Cloud Platform like Firebase Function just yet. The currently good candidate for us is CloudRun so let’s try it together!

local and GCP test

I will use this official ref below 👇 for kick start. And will do some adjustment and simplify it to suite my need like usual so I can reuse it later with no brain.

And here’s my compilation. 👇



  • Bash, Homebrew
  • Docker, Docker Hub, k8s, kind or minikube, a bit of Go
  • GCP, CloudRun
  • A bit of Rust


This will deploy built sample image to CloudRun to prove that it works.

# Install gcloud cli and login (you know what to do right?)
# Deploy samples image to CloudRun
gcloud run deploy --platform=managed

Try online

replace with your own YOUR_ID_BLA_BLA from previous step 👆

curl -w '\n'

Expected output:

Hello World


This will setup homebrew, docker desktop and docker for build image locally.

# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL"
# Install `Docker Desktop`
# Install Docker
brew install docker

This will setup kubectl to run the image locally.

# Install the `Knative` CLI.
brew install kn
# Install the Knative quickstart plugin.
brew install knative-sandbox/kn-plugins/quickstart
# Install go.
brew install go
# Install kind.
go get
# Run the Knative quickstart plugin.
kn quickstart kind
# Verify you have a cluster called `knative`.
kind get clusters

Build image

# Get `username` from Docker hub and sign-in via `Docker Desktop`.
# Clone this repository.
git clone
cd hello-rust-cloudrun
username=katopz 👈 your username
# Build the container on your local machine.
docker build -t $username/helloworld-rust .
# Push the container to docker registry.
docker push $username/helloworld-rust


Deploy again, this time on our local.

# Deploy the app into your cluster.
kubectl apply --filename service.yaml
# Find the URL for your service.
kubectl get ksvc helloworld-rust,URL:.status.url

Expected output:

NAME              URL

Try local

curl -w '\n'

Expected output:

Hello Rust Sample v1


# To remove the app from your cluster, delete the service record.
kubectl delete --filename service.yaml

Other versions

rust:latest = 1.68GB
rust:alpine = 1.23GB // with fixed error: linking with
cc failed.
rust:slim-buster = 1.04GB // recommended

# To build `rust:alpine` image.
docker build -t $username/helloworld-rust . -f alpine.Dockerfile
# To build `rust:slim-buster` image.
docker build -t $username/helloworld-rust . -f slim-buster.Dockerfile


See you next time! 🐈

👍 Updated version w/ actix = 8.48MB (Recommended)



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store