-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker Compose doesn't load .env file and incorrect DATABASE_URL configuration #588
Comments
Hi, can you confirm if the issue I reported is correct? If so, I'd like to work on it. |
Hi @SureshPradhana, thank you for your suggestion, and patience while we were out of office. Can you share the exact connection errors you experienced? They might be specific to your set-up. But we aim to support all environments, so it's important we learn what is going on here. As for loading env vars, I agree they should be mounted to the volume / loaded at runtime, as you demonstrated. Our current set-up isn't best practice, this would be more secure and flexible. |
Hi @kyleecodes, Thanks for the feedback. Here are the connection errors I faced:
i use linux found out that On Linux, In a Docker Compose setup, |
Thank you @SureshPradhana you have been assigned this issue! Support Chayn's mission? ⭐ Please star this repo to help us find more contributors like you! |
Great points @SureshPradhana. Thanks for your patience while we were out of office. |
@leoseg I'm going to assign you to this issue as you have done some work on it. You might need to comment on it before I assign you. |
Okay, I include the fix for this issue in another pull request and linked it there. |
Overview:
There are two main issues in the current Docker setup:
.env
file is not being loaded, causing missing environment variables during runtime.DATABASE_URL
useshost.docker.internal:35000
, which leads to connection errors within the Docker network.These issues prevent the backend service from properly connecting to the PostgreSQL database when using Docker Compose.
Environment:
Actions Needed:
.env
file: Update thedocker-compose.yml
to include theenv_file
directive.DATABASE_URL
: Modify theDATABASE_URL
to use the correct hostname within the Docker network (db:5432
).Proposed Fix:
Load
.env
file:Add the following to the
api
service indocker-compose.yml
:Correct
DATABASE_URL
:Update the
DATABASE_URL
indocker-compose.yml
:DATABASE_URL=postgres://postgres:postgres@db:5432/bloom
The text was updated successfully, but these errors were encountered: