I’m trying to create a Docker Compose that can start an Orthanc and PostgreSQL containers. I currently am able to start both of the containers using Docker Compose, but I am unable to connect Orthanc to PostgreSQL. The main issue I’m having is creating the a database within PostgreSQL. Whenever I start the Docker Compose, it says that the database does not exist. I tried to follow this guide: https://graspingtech.com/docker-compose-postgresql/. I think the issue is with the 01-init.sh script since it is what is supposed to create the database, but it doesn’t seem to be doing that. Does anyone have an idea of why it isn’t working or what I can do to fix it? Thank you.
You might want to check out the Osimis example setups located here:
There are a large number of examples there, including one for Postgres. Read through and try those, and if you are still having problems post more details about your setup, like the .yml file, DockerFile and orthanc.json.
Hi TM you are essentially asking “How can I automatically create a database when launching Postgres container”. This docker image help page should have your answer, specifically, under “Initialization Scripts”. It sounds like you need an create_db.sql file where all you do is create a database with the correct name. Then volume map your .sql file to /docker-entrypoint-initdb.d/ inside of the container file system.