Ah right, I assumed you were trying to connect the lemmy
container to postgres running outside of docker.
One important thing to remember with all docker compose files - the service name (the first keys in the services:
configuration) is also the hostname of that container so to ping lemmy (from some other container in that docker compose) you would do ping lemmy
, same for postgres ping postgres
- but if the postgres service was named db0
then it would be ping db0
.
You also do not have to expose ports - all containers in that compose share one network (exposing is for outside access).
All together your postgres config for lemmy should like this:
database: {
# name of the postgres database for lemmy
database: "lemmy"
# username to connect to postgres
user: "postgres"
# password to connect to postgres
password: "xxxxxxx"
# host where postgres is running
host: "postgres"
# port where postgres can be accessed
port: 5432
# maximum number of active sql connections
pool_size: 10
}
I don’t get what you mean here. Communication over (linux) socket file and TCP/IP is very different.