Skip to content

Orthanc + PostgreSQL issue #10

@BassamAbdallah

Description

@BassamAbdallah

Following https://github.com/orthanc-server/orthanc-setup-samples/tree/master/docker/postgresql
I have an issue which is that my orthanc container seems not being able to communicate with the posgreql container (both are running so far).
All pods are running

CONTAINER ID   IMAGE                 COMMAND                  CREATED         STATUS         PORTS                                          NAMES
1a0545990c3d   orthancteam/orthanc   "/docker-entrypoint.…"   2 seconds ago   Up 2 seconds   0.0.0.0:4006->4006/tcp, 0.0.0.0:80->8042/tcp   orthanc-orthanc-1
c44400f0b5ad   postgres:15           "docker-entrypoint.s…"   2 seconds ago   Up 2 seconds   0.0.0.0:5432->5432/tcp                         orthanc-orthanc-index-1

Below my docker compose and logs from both containers if that may help

version: '3.1'
services:

  orthanc:
    image: orthancteam/orthanc
    depends_on: [orthanc-index]
    restart: unless-stopped
    ports: ["4006:4006", "80:8042"]
    volumes: ["/root/foo/orthanc-db:/var/lib/orthanc/db"]
    environment:
      VERBOSE_ENABLED: "true"
      VERBOSE_STARTUP: "true"
      OSIMIS_WEB_VIEWER1_PLUGIN_ENABLED: "true"
      # DicomWeb configurations
      DICOM_WEB_PLUGIN_ENABLED: "true"
      ORTHANC__DICOM_WEB__SERIES_METADATA: "Full"
      ORTHANC__DICOM_WEB__STUDIES_METADATA: "Full"
      ORTHANC__DICOM_WEB__METADATA_WORKER_THREADS_COUNT : "4"
      # StoneViewer configurations
      STONE_WEB_VIEWER_PLUGIN_ENABLED: "true"
      ORTHANC__STONE_WEB_VIEWER__DATE_FORMAT: "DD/MM/YYYY"
      #Postgre index?
      ORTHANC__POSTGRESQL: |
        {
          "Host": "orthanc-index",
          "EnableVerboseLogs": true
        }
      ORTHANC_JSON: |
        {
          "Name": "FOO",
          "DicomAet": "FOO",
          "DicomPort" : 4006,
          "RemoteAccessAllowed": true,
          "RestApiWriteToFileSystemEnabled": true,
          "AuthenticationEnabled" : false,
          "DicomWeb": {
            "Enable": true,
            "Root": "/dicom-web/",
            "EnableWado": true
          }
        }
  orthanc-index:
    image: postgres:15
    restart: unless-stopped
    ports: ["5432:5432"]
    volumes: [/root/foo/orthanc-index:/var/lib/postgresql/data"]
    environment:
      POSTGRES_HOST_AUTH_METHOD: "trust"

Error log from the orthanc container

W0616 13:35:22.134234             MAIN OrthancInitialization.cpp:543] Storage directory: "/var/lib/orthanc/db"
E0616 13:35:22.135971             MAIN postgresql-index:/PostgreSQLDatabase.cpp:111] PostgreSQL error: connection to server at "orthanc-index" (192.168.64.2), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?

W0616 13:35:22.136118             MAIN postgresql-index:/RetryDatabaseFactory.cpp:52] Database is currently unavailable, retrying...

The posgre pod is correcly at this adress I checked using:

docker exec -it c44400f0b5ad /bin/bash
root@c44400f0b5ad:/# hostname -I
192.168.64.2

Logs from the postgre pod

********************************************************************************
WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This will allow
         anyone with access to the Postgres port to access your database without
         a password, even if POSTGRES_PASSWORD is set. See PostgreSQL
         documentation about "trust":
         https://www.postgresql.org/docs/current/auth-trust.html
         In Docker's default configuration, this is effectively any other
         container on the same system.

         It is not recommended to use POSTGRES_HOST_AUTH_METHOD=trust. Replace
         it with "-e POSTGRES_PASSWORD=password" instead to set a password in
         "docker run".
********************************************************************************
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start

waiting for server to start....2025-06-16 13:35:22.351 UTC [50] LOG:  starting PostgreSQL 15.13 (Debian 15.13-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2025-06-16 13:35:22.352 UTC [50] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-06-16 13:35:22.358 UTC [53] LOG:  database system was shut down at 2025-06-16 13:35:22 UTC
2025-06-16 13:35:22.364 UTC [50] LOG:  database system is ready to accept connections
 done
server started

/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

2025-06-16 13:35:22.470 UTC [50] LOG:  received fast shutdown request
waiting for server to shut down....2025-06-16 13:35:22.472 UTC [50] LOG:  aborting any active transactions
2025-06-16 13:35:22.476 UTC [50] LOG:  background worker "logical replication launcher" (PID 56) exited with exit code 1
2025-06-16 13:35:22.476 UTC [51] LOG:  shutting down
2025-06-16 13:35:22.478 UTC [51] LOG:  checkpoint starting: shutdown immediate
2025-06-16 13:35:22.485 UTC [51] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.001 s, sync=0.002 s, total=0.009 s; sync files=2, longest=0.002 s, average=0.001 s; distance=0 kB, estimate=0 kB
2025-06-16 13:35:22.490 UTC [50] LOG:  database system is shut down
 done
server stopped

PostgreSQL init process complete; ready for start up.

2025-06-16 13:35:22.596 UTC [1] LOG:  starting PostgreSQL 15.13 (Debian 15.13-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2025-06-16 13:35:22.596 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2025-06-16 13:35:22.596 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2025-06-16 13:35:22.598 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-06-16 13:35:22.602 UTC [64] LOG:  database system was shut down at 2025-06-16 13:35:22 UTC
2025-06-16 13:35:22.607 UTC [1] LOG:  database system is ready to accept connections

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions