Unable to start Apache Superset due to failed PostgresDB connection using Docker

I am trying to install Superset using Docker. However, following the instructions, I am encountering an issue where the database connection is refused. I check the logs, the container responsible for database service is up and running but when I checked its logs, I see the following FATAL message:

2020-09-08 17:19:36.863 UTC [33] FATAL:  database "test" does not exist

This is how I attempt to install Superset.

Following is the error I face when I run the command, sudo docker-compose up:

superset_app             | ERROR:flask_appbuilder.security.sqla.manager:DB Creation and initialization failed: (psycopg2.OperationalError) could not connect to server: No route to host
superset_app             |  Is the server running on host "db" (172.18.0.3) and accepting
superset_app             |  TCP/IP connections on port 5432?
superset_app             | 
superset_app             | (Background on this error at: http://sqlalche.me/e/13/e3q8)

The same error appears in other services as well. Click here for the docker-compose.yaml file, and here for the environment file.

I tried to work out this issue from any of the solutions presented in the official repository but in vain.
How do I resolve this issue and complete the installation?

Source: Docker Questions