Build Image From Dockerfile

Hi,

I’m trying to build EHRBase image from Docker . Seems to be throwing error when i run " docker run ehrbaseorg/ehrbase".

Errors are mentioned below:

  1. org.postgresql.util.PSQLException: The connection attempt failed.

  2. Error creating bean with name ‘flywayInitializer’ defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.exception.FlywaySqlException:
    Unable to obtain connection from database: The connection attempt failed.

3.Caused by: java.net.UnknownHostException: ehrdb

Please let me know what I’m missing.

Thanks

Hi Raksha,

it looks to me that the postgres database is missing. The database needs to run first before EHRbase can be started. There is an example im the readme:

docker network create ehrbase-net
docker run --name ehrdb --network ehrbase-net -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 ehrbaseorg/ehrbase-postgres:latest

Hope this helps! :slight_smile:

Thanks, Birger.

It worked for me.

Hello Raksha,
Can you describe a bit more how you eventually able to run the ehrbase container?
Did you startoff orginally with the docker-compose.yml file, ran it and ran into the problems?

I have similar problem getting the ehrbase_1 container to run (no issue with running the database container however).
I received identical error as yours, namely:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘flywayInitializer’ defined in class path resource

The cause of this error is:
[org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Driver org.postgresql.Driver claims to not accept jdbcUrl, ‘jdbc:postgresql://ehrdb:5432/ehrbase’

I stopped all the running container. I followed haarbrandt’s suggestion by creating the ehrbase-net first, then run the postgres db container using the command line from haarbrandt above.
I even let for db container service ran for 20min before I restart ehrbase container. Same result. ehrbase container service started, ran for 11s or so, stopped, restarted, failed again, …

Base on the screenshot attached, can someone suggest what the cause of the problem might be?
I looked at the log file for postgresql. There was no error.

Thanks in advance.
John

Hi John,

I was getting this error before installing docker-composer. I ran the command mentioned below and it worked.

docker network create ehrbase-net docker run --name ehrdb --network ehrbase-net -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 ehrbaseorg/ehrbase-postgres:latest

Once postrgres is installed, Follow the steps mentioned below in the attached link.

https://docs.google.com/document/d/1KEmUU-le6pXJ665Y_-UV9hKj2OBimmbBdaWPehvt7mA/edit?usp=sharing

Hope this helps :slight_smile:

Hi both,

just a quick remark on the google docs: you don’t have to download the complete EHRbase project with all sources if you only want to execute the docker compose scripts. Of course you can also build the code yourself, which is straight forward given you have the JDK for Java 11 and Maven on your computer. Please note that the build process would also require the postgres database to run properly.

Hello Raksha, Birger
Thank you Raksha for the instruction. There are a few interesting things.
Using Raksha’s instructions from the google doc, I have no issues running the containers. But to access the Swagger UI (I don’t know what it is yet), I have issues. I am going to look into this. But it is a very good start that I have both containers running. Thank you Raksha.
My issues: I am not using Linux base OS. I am using Win10 OS with Hyper-V disable.
I leverage Vagrant/VirtualBox to run a guest Ubuntu and implement all my docker apps within this environment.
So, I can’t directly open a web browser to point to the URL your document mentioned. But I shall figure out how to (like opening private IP channel on the host OS).
My original problem was the failure of running ehrbase container (refer to the attached screenshot of the log of the ehrbase container).
I tried to run the example from: https://github.com/OpusVL/ehrbase-docker-compose.
I had a hunch why ehrbase service failed to run and was testing it. Then I just noticed Birger latest comment. I think my suspicious may be correct. I shall test it later today and post my result (I am tied up with another task currently).
Thank you both.