[Joplin Server] Use host Postgresql instead of container

Operating system

Linux

Joplin version

2.14.20

What issue do you have?

Hello,
I'm trying to setup a Joplin Server container but I want to use my existing Postgresql instance running on the host system witch powers other services.
I created a new user and database and allowed connections from Docker IPs (172.17.0.0/64) on the Postgresql side of thing and edited the docker-compose.yml like this:

version: '3'

services:
  #    db:
  #      image: postgres:16
  #      volumes:
  #          - ./data/postgres:/var/lib/postgresql/data
  #      ports:
  #          - "5432:5432"
  #      restart: unless-stopped
  #      environment:
  #          - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
  #          - POSTGRES_USER=${POSTGRES_USER}
  #          - POSTGRES_DB=${POSTGRES_DATABASE}
    app:
        image: joplin/server:latest
          #      depends_on:
          #  - db
        ports:
            - "22300:22300"
        restart: unless-stopped
        environment:
            - APP_PORT=22300
            - APP_BASE_URL=http://localhost:22300
            - DB_CLIENT=pg
            - POSTGRES_PASSWORD=password
            - POSTGRES_DATABASE=joplin
            - POSTGRES_USER=joplin
            - POSTGRES_PORT=5432
            - POSTGRES_HOST=172.17.0.1

However, when i run docker-compose up i get those warning during startup:

a6a3f02ffdbb_joplin_app_1 | 18:47:58 0|app  | 2024-06-14 18:47:58: App: Content driver: { type: 1 }
a6a3f02ffdbb_joplin_app_1 | 18:47:58 0|app  | 2024-06-14 18:47:58: App: Content driver (fallback): null
a6a3f02ffdbb_joplin_app_1 | 18:47:58 0|app  | 2024-06-14 18:47:58: App: Trying to connect to database...
a6a3f02ffdbb_joplin_app_1 | 18:47:58 0|app  | 2024-06-14 18:47:58: db: Could not connect. Will try again. connect ECONNREFUSED 172.17.0.1:5432

and the latest line keeps repeating indefinitely

This is my first time using Docker, so I have no idea if I did something wrong. Can someone give me some hints?
Thanks a lot!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.