Is it possible to connect to the database directly from a separate app?

Thanks for the info @Nacho_Caballero… especially the link about docker!

Seems like the advice in your (and the other) thread was correct, you need:

expose:
  - "127.17.0.1:5432:5432"

…as mentioned in that link, Docker will automatically forward on to the correct IP for your container (which makes sense given those IPs are dynamic - something I had wondered). I would think this is all that’s needed for most setups.

I’d already tried that though - so you may be wondering what my problem was. My firewall! (I thought I recognised the psql: server closed the connection unexpectedly error!)

All sorted now - thank you everyone :blush: