Dumb question from a #Docker noob!
-
Dumb question from a #Docker noob!
How does one connect to postgresql on the host machine from a docker container?
Since localhost is the container localhost. I tried gateways and even public ip with port but thats baaaad.
Also, for #Channel, this URL needs to point to the public or internal(host machine)?
https://github.com/patchwork-hub/patchwork_dashboard/blob/daf539aa5c921af4a7435db8acb5fe0d2bf5b249/.env.sample#L17
(again localhost = container)@stux basically let pg listen on 0.0.0.0 and map its port to the outside
-
@jorijn hm, this is the compose: https://raw.githubusercontent.com/patchwork-hub/patchwork_dashboard/refs/heads/main/docker-compose.yml
it should be able to reach the internal net right?
@stux I'm not sure what you are trying to accomplish? Does the dashboard service need to connect to postgres on the host?
-
@stux basically let pg listen on 0.0.0.0 and map its port to the outside
@phoenixgee Got that! but for the mapping, is it internal:external in https://raw.githubusercontent.com/patchwork-hub/patchwork_dashboard/refs/heads/main/docker-compose.yml ?
-
@stux I'm not sure what you are trying to accomplish? Does the dashboard service need to connect to postgres on the host?
@jorijn Yes! It runs a container with the dashboard that needs to connect to masto/post on the host itself
-
@phoenixgee Got that! but for the mapping, is it internal:external in https://raw.githubusercontent.com/patchwork-hub/patchwork_dashboard/refs/heads/main/docker-compose.yml ?
@stux external:internal
-
@jorijn Yes! It runs a container with the dashboard that needs to connect to masto/post on the host itself
@stux then you should try host.docker.internal:5432
-
@stux then you should try host.docker.internal:5432
@jorijn Correct
Post is running on host machine on * basically so it /should/ accept but somehow i could not get the connection to outside the container
this shouldn't be hard at all
-
@jorijn Correct
Post is running on host machine on * basically so it /should/ accept but somehow i could not get the connection to outside the container
this shouldn't be hard at all
@stux it's basic networking under the hood. Have you tried 172.17.0.1?
-
@stux it's basic networking under the hood. Have you tried 172.17.0.1?
@jorijn Yup, same result
-
@jorijn Correct
Post is running on host machine on * basically so it /should/ accept but somehow i could not get the connection to outside the container
this shouldn't be hard at all
-
Dumb question from a #Docker noob!
How does one connect to postgresql on the host machine from a docker container?
Since localhost is the container localhost. I tried gateways and even public ip with port but thats baaaad.
Also, for #Channel, this URL needs to point to the public or internal(host machine)?
https://github.com/patchwork-hub/patchwork_dashboard/blob/daf539aa5c921af4a7435db8acb5fe0d2bf5b249/.env.sample#L17
(again localhost = container)@stux Hey. Also a n00b here. But you can create custom networks. So both containers can see each other.
My Joplin server has a network just to connect to the postgresql database and one to connect to my Nginx Proxy Manager.
-
Dumb question from a #Docker noob!
How does one connect to postgresql on the host machine from a docker container?
Since localhost is the container localhost. I tried gateways and even public ip with port but thats baaaad.
Also, for #Channel, this URL needs to point to the public or internal(host machine)?
https://github.com/patchwork-hub/patchwork_dashboard/blob/daf539aa5c921af4a7435db8acb5fe0d2bf5b249/.env.sample#L17
(again localhost = container)@stux I don't know if it will work since there's a decent chance that postgres does some magic with SO_PEERCRED but you may also want to look into forwarding over the unix socket, since in theory that would bypass the TCP/IP stack entirely.