Connecting to PostgreSQL with Docker image

0
Hi fellow Mendix developers, I've been getting into using Docker in combination with Mendix applications. For this, I've followed the Mendix documentation (deploying and running images). However, I'm not able to run the Docker image (step 4 here). When I run the docker run -it command, I get the following error: ERROR - ConnectionBus: Opening JDBC connection to Some(localhost:5432) failed with SQLState: 08001 Error code: 0 Message: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. Retrying...(1/4) WARNING - ConnectionBus: Database connections: 0 active, 0 idle. ERROR - ConnectionBus: Opening JDBC connection to Some(localhost:5432) failed with SQLState: 08001 Error code: 0 Message: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. Retrying...(2/4) WARNING - ConnectionBus: Database connections: 0 active, 0 idle. ERROR - ConnectionBus: Opening JDBC connection to Some(localhost:5432) failed with SQLState: 08001 Error code: 0 Message: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. Retrying...(3/4) WARNING - ConnectionBus: Database connections: 0 active, 0 idle. ERROR - ConnectionBus: Opening JDBC connection to Some(localhost:5432) failed with SQLState: 08001 Error code: 0 Message: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections., giving up...(4/4) WARNING - ConnectionBus: Cannot create database connection. I'm trying to connect to my database in PostgreSQL, which I've configured via PgAdmin. I have tried to connect to this database with my application locally in Mendix Studio Pro and this works fine. I’m probably missing something simple, but I cannot find examples of run commands which enlighten how you set up the database connection (it was asked earlier on this forum question, however not properly answered).  The run call I'm using is: docker run -it \ -e ADMIN-PASSWORD={somepassword} \ -e DATABASE_ENDPOINT=postgres://{username}:{password}@localhost:5432/{databasename} \ {imagename} I'm using the same postgres username, password, URL and databasename as in the configuration of Mendix Studio Pro, which is working.  I'm not sure if it is relevant, as the build continues after these errors, but when running I also get the following lines: WARNING: CF_INSTANCE_INDEX environment variable not found. Assuming responsibility for scheduled events execution and database synchronization commands. ERROR: Unable to fixup permissions of directory 'model' with mode 700: [Errno 1] Operation not permitted: '/opt/mendix/build/model', Ignoring. ERROR: Unable to fixup permissions of directory 'web' with mode 755: [Errno 1] Operation not permitted: '/opt/mendix/build/web', Ignoring. ERROR: Unable to fixup permissions of directory 'data' with mode 700: [Errno 1] Operation not permitted: '/opt/mendix/build/data', Ignoring. Thanks in advance!
asked
1 answers
1

Hi Daan,

are you using docker on Windows and which version?

First: the error message at the end of your question should not matter. I get these always.

To the error: I needed to change localhost to docker.for.win.localhost in my setup to get it running.

Regards

Thilo

 

answered