Why are you using environment variables for the db username and password? Are these for the proxy user or the Cloud SQL user. I have a proxy running in cloud shell just like this, and a Node.js app running in cloud shell as well and I can connect to my database (previewing successful connection in cloud shell web preview). When I containerize my app with docker I get an ECONREFUSED error. Does this have anything to do with those environment variables you are using?