-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
PG::ConnectionBad: could not translate host name "db" to address: Name or service not known #13890
Comments
in docker-compose.yml
|
This solved the issue. I was able to run docker-compose run --rm web rails db:migrate successfully, then docker-compose run --rm web rails assets:precompile |
May I as why it is safe to add "POSTGRES_HOST_AUTH_METHOD=trust" when the error message says "This is not recommended." |
You have no password set for your postgres container and everything can connect to it in the default Docker configuration. If you publish the port and have no firewall you basically have an open postgres on the internet. Not recommend. Set a password. |
set the env variables correctly:
Make sure the your app is on the same network as the db (internal_network) and provide the correct env variables.
Finally, make sure you're using the same values in database.yml default: &default
adapter: postgresql
encoding: unicode
host: <%= ENV["POSTGRES_HOST"] %>
user: <%= ENV["POSTGRES_USER"] %>
password: <%= ENV["POSTGRES_PASSWORD"] %> NB: If you have a volume attached, make sure it doesn't introduce existing details. Remove it or deal with that however you want. |
When at the installation step of
docker-compose run --rm web rails db:migrate
is run I get the error message:Running docker logs on the mastodon_db_1 container shows this error message:
I have tried docker-compose run -e POSTGRES_PASSWORD=password --rm web rails db:migrate to the same error message.
This is my docker compose file. I have all the containers on an internal network.
https://gist.github.com/y2klol/f785835402ae366c167ef79e712be692
The text was updated successfully, but these errors were encountered: