create-t3 connect docker server to docker database
I‘ve used the create-t3 framework to set up my project and I‘d like to use it with a postgres database hosted in a docker container. This worked fine I just used the start-db.sh script that gets generated.
Now I‘m trying to build a docker image for deploying my app and the process works fine until I try to access the database. I have the postgres container running and started but I can‘t figure out how to connect to it… i just get an Invalid URL error.
I‘m using docker compose to inject the environment arguments but the URL with localhost doesnt seem to work. I also tried to use the docker bridge network and used 172.17.0.3 as the IP but that didnt work either. How can i configure this correctly so my docker server can access the docker database
3 Replies
would you mind sharing the compose files (of course with the sensible information redacted)?
I figured it out. The problem was i started one container with docker compose and the other with "regular" docker via the run command. Don't know why docker didn't like that but starting both with docker run worked for me
perfect