Connect cosmos db from local web app container

I have developed a web app using next js and able to connect to the cosmos db when I run it in my local machine.

I am planning to deploy the application in azure app services.
before that I have dockerized my application and running in my machine as a container, everything is working fine except the database connection. it is throwing unexpected run time error, network error.

Could anyone help me here?