Running Bahmni on Docker

The following guide helps you in installing Bahmni using Docker. Docker is an open platform for developers and system admins to build, ship, and run distributed applications. Following instructions are mainly targeted for Mac OS X and Linux users. But they should work with any operating system that supports Docker. You will need to first install docker (and docker-compose). If you are new to Docker, then we encourage you to watch this 15-min introduction to Docker: https://www.youtube.com/watch?v=rOTqprHv1YE

Docker installations

You can install Docker from here. Choose the appropriate installers for your host machine and follow the instructions mentioned for the host platform.  MacOS: You can get the dmg file for Docker here

Note: If you are using Docker Desktop for Mac / Docker Desktop for Windows , it is recommended to increase the Memory resource to at-least 4GB. Please find the reference for Mac / Windows.

Once you have Docker installed, ensure that you are running the daemon. If you want to tune and configure docker, please find detailed information here

While it is not mandatory that you have working knowledge of docker (although desirable), at the least you should know the following commands and usages

  1. docker ps -a   - shows all containers

  2. docker rm <container id> - remove a given container 

  3. docker container COMMAND - different commands like start/stop/prune for container(s)

  4. docker images - lists all images

  5. docker rmi <image id> - remove a given image 

  6. docker volume COMMAND - different commands for managing volumes. 

A good link: The Ultimate Docker cheatsheet

Docker Compose installations

Note : If you are using Docker Desktop for Mac / Docker Desktop for Windows, then docker-compose comes bundled with docker and you need not follow the below steps. But make sure to disable Experimental Features for docker-compose from your Docker Dashboard preferences. For other operating systems, you can install docker compose from here.

Currently Bahmni has been tested on docker-compose version 1.29.2. If you are using older versions of docker-compose, please upgrade to the latest version. You can check docker compose version by running docker-compose version

Bahmni Docker Setup Process

Briefly, these are the main steps:

  1. Install latest stable versions of docker & docker-compose in your machine (based on your respective OS)

  2. Clone the bahmni-package repository (Github Link).

  3. Run the docker-compose command from the bahmni-docker sub-directory (e.g: docker-compose --profile openmrs up to start only the EMR/OpenMRS part of the Bahmni suite)

  4. Bahmni should now be running (open browser at URL: http://localhost/bahmni/home). There are a few simple first time setup steps also to be followed. For exact steps and detailed documentation, please see (README.md) Bahmni Github docker here: https://github.com/Bahmni/bahmni-package/tree/master/bahmni-docker. If you run into issues, feel free to ask questions on Bahmni Slack #community channel.

Poor to no internet connectivity

Installing Bahmni using docker-compose would require better internet connectivity since the individual Bahmni services/application images (odoo, openmrs, reports, implementer interface etc) needs to be downloaded on the host machine before running the containers. This would be a challenge for facilities where there is poor to no internet connectivity. Please follow below steps as a work-around to perform the installation

  • Download and create archive backup for all Bahmni application images at the location where you have internet connectivity

1 2 $ docker pull bahmni/bahmni-web $ docker save bahmni/bahmni-web > bahmni_web.tar

If you have capacity constrains, you can also gzip the archive and make the backup smaller

1 docker save bahmni/bahmni-web | gzip > bahmni_web.tar.gz

Note: please check the bahmni docker-compose for the list of services/application images that you would need to download and create archive e.g. bahmni/openmrs, bahmni/implementer-interface etc. Also note that if you prefer a specific version of the image then add a tag e.g. docker pull bahmni/bahmni-web:1.0.0

  • Once you have the archives, you can easily port these into usb hard drive or pen drive

  • You can then mount the usb pen drive to your host machine and load docker images from the archive

1 $ docker load --input bahmni_web.tar

Other Reference Material

  1. To see current status of Bahmni dockerization work, and to contribute in this, please see this page: Bahmni Dockerization Status

  2. ALTERNATIVE: Mekom Solutions has also dockerized Bahmni and deployed it in various Production scenarios. If you wish to check that out, see this Github repo: https://github.com/mekomsolutions/bahmni-docker-compose