Skip to content
0
  • Home
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
  • Home
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Sketchy)
  • No Skin
Collapse

Wandering Adventure Party

  1. Home
  2. Uncategorized
  3. Dumb question from a #Docker noob!

Dumb question from a #Docker noob!

Scheduled Pinned Locked Moved Uncategorized
dockerchannel
15 Posts 6 Posters 33 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • stux⚡S stux⚡

    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)

    Phoenix GeeP This user is from outside of this forum
    Phoenix GeeP This user is from outside of this forum
    Phoenix Gee
    wrote on last edited by
    #4

    @stux basically let pg listen on 0.0.0.0 and map its port to the outside

    stux⚡S 1 Reply Last reply
    0
    • stux⚡S stux⚡

      @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?

      Jorijn SchrijvershofJ This user is from outside of this forum
      Jorijn SchrijvershofJ This user is from outside of this forum
      Jorijn Schrijvershof
      wrote on last edited by
      #5

      @stux I'm not sure what you are trying to accomplish? Does the dashboard service need to connect to postgres on the host?

      stux⚡S 1 Reply Last reply
      0
      • Phoenix GeeP Phoenix Gee

        @stux basically let pg listen on 0.0.0.0 and map its port to the outside

        stux⚡S This user is from outside of this forum
        stux⚡S This user is from outside of this forum
        stux⚡
        wrote on last edited by
        #6

        @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 ?

        Phoenix GeeP 1 Reply Last reply
        0
        • Jorijn SchrijvershofJ Jorijn Schrijvershof

          @stux I'm not sure what you are trying to accomplish? Does the dashboard service need to connect to postgres on the host?

          stux⚡S This user is from outside of this forum
          stux⚡S This user is from outside of this forum
          stux⚡
          wrote on last edited by
          #7

          @jorijn Yes! It runs a container with the dashboard that needs to connect to masto/post on the host itself

          Jorijn SchrijvershofJ 1 Reply Last reply
          0
          • stux⚡S stux⚡

            @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 ?

            Phoenix GeeP This user is from outside of this forum
            Phoenix GeeP This user is from outside of this forum
            Phoenix Gee
            wrote on last edited by
            #8

            @stux external:internal

            1 Reply Last reply
            0
            • stux⚡S stux⚡

              @jorijn Yes! It runs a container with the dashboard that needs to connect to masto/post on the host itself

              Jorijn SchrijvershofJ This user is from outside of this forum
              Jorijn SchrijvershofJ This user is from outside of this forum
              Jorijn Schrijvershof
              wrote on last edited by
              #9

              @stux then you should try host.docker.internal:5432

              stux⚡S 1 Reply Last reply
              0
              • Jorijn SchrijvershofJ Jorijn Schrijvershof

                @stux then you should try host.docker.internal:5432

                stux⚡S This user is from outside of this forum
                stux⚡S This user is from outside of this forum
                stux⚡
                wrote on last edited by
                #10

                @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 SchrijvershofJ Todd KnarrT 2 Replies Last reply
                0
                • stux⚡S stux⚡

                  @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 SchrijvershofJ This user is from outside of this forum
                  Jorijn SchrijvershofJ This user is from outside of this forum
                  Jorijn Schrijvershof
                  wrote on last edited by
                  #11

                  @stux it's basic networking under the hood. Have you tried 172.17.0.1?

                  stux⚡S 1 Reply Last reply
                  0
                  • Jorijn SchrijvershofJ Jorijn Schrijvershof

                    @stux it's basic networking under the hood. Have you tried 172.17.0.1?

                    stux⚡S This user is from outside of this forum
                    stux⚡S This user is from outside of this forum
                    stux⚡
                    wrote on last edited by
                    #12

                    @jorijn Yup, same result

                    1 Reply Last reply
                    0
                    • stux⚡S stux⚡

                      @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 😆

                      Todd KnarrT This user is from outside of this forum
                      Todd KnarrT This user is from outside of this forum
                      Todd Knarr
                      wrote on last edited by
                      #13

                      @stux @jorijn Does Postgres have the TCP port enabled? Common configuration is to use a unix socket only, which works for vanilla localhost but doesn't work when you need a real TCP socket to connect to.

                      1 Reply Last reply
                      0
                      • stux⚡S stux⚡

                        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)

                        Jasper BumaJ This user is from outside of this forum
                        Jasper BumaJ This user is from outside of this forum
                        Jasper Buma
                        wrote on last edited by
                        #14

                        @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.

                        Link Preview ImageLink Preview Image
                        1 Reply Last reply
                        0
                        • stux⚡S stux⚡

                          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)

                          hexaheximalH This user is from outside of this forum
                          hexaheximalH This user is from outside of this forum
                          hexaheximal
                          wrote on last edited by
                          #15

                          @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.

                          1 Reply Last reply
                          0

                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Login or register to search.
                          Powered by NodeBB Contributors
                          • First post
                            Last post