'How to get the Google Cloud Run container name using Node.js?

I'm very new to GCP, and am working toward deploying a cloud run container. Part of my project will require that I get the name of the container via code in Node.js. Is there a way that I can do this?

I have done a bunch of research, but have not found an answer. As a note, my cloud run container will not auto-scale. There will be only one instance.

const container = require('@google-cloud/container')
let containerName = container.name


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source