Running Node-RED on Google Cloud Platform under Docker

Node-RED is very interesting. The Node-RED documentation does not include instructions for running Node-RED on Google Cloud Platform (GCP). If you haven’t used GCP, there’s a 60-day free trial.

It’s very easy to run Node-RED on a GCP.

If you’ve not used Google Cloud Platform before, start here. Otherwise, assuming you have a project [[PROJECT-ID]] and have the Cloud SDK installed, let’s start by defining some environment variables:

NODE=[[NODE-NAME]] # e.g. "node-red"
ZONE=[[ZONE]] # e.g. "us-east1-d"
CONTAINER_FILE=[[CONTAINER-FILENAME]] # e.g. "node_red.yaml"

To make things simplest, we’re going to run Node-RED in Docker on the VM. We provide a configuration file to GCP with the command to create the VM.

Create a file called whatever you’ve decided for [[CONTAINER_FILE]] and use the following text for its content. This tells GCP where to find the Docker image for Node-RED and to run it on port 1880:

apiVersion: v1
kind: Pod
name: node-red
- name: node-red
image: nodered/node-red-docker:latest
imagePullPolicy: Always
- containerPort: 1880
hostPort: 1880

Now, to create a VM running Docker, with Node-RED installed and configured using the [[CONTAINER_FILE]], use the following command:

gcloud compute instances create $NODE \
--image=container-vm \
--metadata-from-file=google-container-manifest=$CONTAINER_FILE \
--machine-type=custom-1-2048 \
--zone=$ZONE \
--project=$PROJECT \

When the command completes and the VM is created, it will summarize the VM details including the EXTERNAL_IP address. Keep a record of this EXTERNAL_IP address as it is the IP address you will use to browse to Node-RED. You may also find the EXTERNAL_IP for your NODE with this command:

gcloud compute instances list \
--filter=NAME=$NODE \
--format='table[no-heading](EXTERNAL_IP)' \

In order to access the Node-RED VM from other machines, you must open the firewall for port 1880. Use this command:

gcloud compute firewall-rules create allow-node-red \
--project=$PROJECT \
--allow tcp:1880 \
--network=default \
--source-ranges= \

That’s it!

You should now be able to visit Node-RED using the following URL. Replace EXTERNAL_IP with the IP address that you determined previously:

Node-Red — ready for use!

And, then with the “first flow” deployed:


To delete the VM and delete the firewall, use the following commands:

gcloud compute instances delete $NODE \
--project=$PROJECT \
gcloud compute firewall-rules delete allow-node-red \
--project=$PROJECT \


It’s very easy to run Node-RED in a container on a VM in Google Cloud Platform. Have fun!