The environment variables in your docker-compose.yml file are indeed pulled from your project's .env file. So, you should ensure that the values in your .env file match the ones you're trying to use to connect to your PostgreSQL database.
Here's what you should input into the TablePlus GUI to connect to the database in the Docker container:
-
Host:
localhostor127.0.0.1 -
Port:
5432(or whatever value you have set forFORWARD_DB_PORTin your.envfile) -
User: The value of
DB_USERNAMEin your.envfile -
Password: The value of
DB_PASSWORDin your.envfile -
Database: The value of
DB_DATABASEin your.envfile
If you're still having trouble connecting, you might want to check the logs of your PostgreSQL container to see if there are any error messages that might help you diagnose the problem. You can do this by running the following command in your terminal:
docker logs <container_id>
Replace <container_id> with the ID of your PostgreSQL container. You can get the ID by running docker ps and looking for the container that's running the postgres:13 image.
Also, ensure that the PostgreSQL service is running inside the Docker container. You can do this by running the following command:
docker exec -it <container_id> pg_isready
This command will tell you if the PostgreSQL server inside the container is ready to accept connections. If it's not, you might need to troubleshoot why the server isn't starting up correctly.