Dhis2 docker image

Wow, saw the dhis2 docker image available.
Tried to run it from the docker repo but failed with the following exception:

Hibernate configuration loaded, using dialect: org.hisp.dhis.hibernate.dialect.DhisPostgresDialect, region factory: org.hibernate.cache.ehcache.EhCacheRegionFactory (DefaultHibernateConfigurationProvider.java [localhost-startStop-1])
Aug 23, 2019 10:13:35 AM org.postgresql.Driver connect
SEVERE: Connection error:
org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:275)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)

Try to compile and run with the default database following the instructions.
But the database is not being create. Exits with the following error:

/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/create-target-db.sh
: invalid option /docker-entrypoint-initdb.d/create-target-db.sh: line 2: set: -
dhis2-database | set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [–] [arg …]
dhis2-database exited with code 2

Any advise?



Hi @prabha,

Happy to see your interest in our docker images. Your question is a nice reminder that we should add docs on how to actually use the image :slight_smile:

Our image contains war file for dhis2 core, but you still need to point it to your database in the dhis.conf file. That file should be provided to docker container via volume.

docker run -v $pathToLocalHomeDir:/DHIS2_home dhis2/core:2.32.1


docker run -v $pathToLocalHomeDi/dhis.conf:/DHIS2_home/dhis2.conf dhis2/core:2.32.1

If you use docker-compose, here is an example of our set up.

If you did that and you still can’t run the container, please send us more information about your set up.

1 Like


I use docker-compose and the compose script i use is

It seems to have a database included in the compose.

1 Like


I see, looks like you you are using old docker image. Dhis-web is the old image repository, that was initiated and supported by @pgracio for a long time. We haven’t removed it, because it is still used by community. All the other repositories (core-dev, core) are supported by DHIS2 team and that was what my first answer was about. We encourage community to give our official images a try, but If you want to continue using the old image, I will let others who uses the same repository answer. :slight_smile:

1 Like