Skip to content
Daler edited this page Sep 25, 2023 · 11 revisions

ABOUT d2-docker

D2-docker is a wrapper over docker and docker-compose that manages DHIS2 server instances from the command-line. D2-docker is implemented in Python 3 and provides both an executable and a Python module to extend from.

The CLI (command-line interface) resembles that of _docker-compose_​, with a set of custom command needed to interact with DHIS2 instances. A user familiar with the docker infrastructure can still use docker to interact with the base infrastructure (containers, images, volumes, and so on) should they need to.

License: GNU GPL v3

imagen

TECHNICAL REQUIREMENTS

D2-docker has been tested on ​ GNU/Linux​ (specifically, Ubuntu 18.04 and Arch Linux), ​ Windows 10​ and ​ MacOS X (​10.14, Mojave). A typical DHIS2 instance takes around 4-8GB of RAM, so make sure you have that free memory for all the servers you are planning to run simultaneously.

External dependencies:

  • Python >= 3.5 (with setuptools)
  • Docker >= 18
  • Docker compose >= 1.17
  • RAM memory: At least 4Gb for instance, preferably 8Gb.

Ubuntu 18.04

$ sudo apt install docker.io docker-compose python3 python3-setuptools

Windows 10

imagen

NOTE:​ If your computer has more than 2 CPUs, we encourage you to increase the CPUs to 4, making DHIS2 dockers run more softly.

NOTE 2:​ If, when starting a the d2-docker instance, there is an error about instace name that couldn't be found, you must access the docker application settings and uncheck the "use v3 version of docker-compose", the 2nd version corrects that problem.

MacOS

Install Docker Desktop. Choose the correct version for your MAC Chipset. At the moment of writing this document Docker Desktop version is 4.23.0

Screenshot 2023-09-25 at 11 45 45 AM

In the Docker Desktop turn on the features:

  • Use Rosetta for x86/amd64 emulation on Apple Silicon &
  • File Sharing implementations should remain VirtioFS to enable virtualization
Screenshot 2023-09-25 at 11 47 04 AM
  • Install python with homebrew

brew install python

brew postinstall python

  • Install pip with homebrew
  • Install pyenv and choose python version 3.9.16

Ensure that the correct version of python is run when running root commands as we will use root permissions on some of the commands. For example running:

sudo pyenv global 3.9.16

  • Clone repository of d2-docker https://github.com/EyeSeeTea/d2-docker.git
  • Install requests

pip install requests

Modify local files to make the rest of the installation work

Modify the file src/d2_docker/docker-compose.yml to comment out the lines:

  • ${DHIS_CONF}:/config/override/dhis2/dhis.conf and
  • "${TOMCAT_SERVER}:/config/override/tomcat/server.xml"

It should look like this:

Screenshot 2023-09-25 at 9 03 44 PM
  • Modify the file src/d2_docker/config/dhis2-core-start.sh to add a true fallback to the lines that copy files in the function setup_tomcat()

It should look like this:

Screenshot 2023-09-25 at 9 03 58 PM

Now the local environment should work. Start up a default empty image to test:

run

sudo python setup.py install

sudo d2-docker create core docker.eyeseetea.com/eyeseetea/dhis2-core:2.37.9 --version=2.37.9

sudo d2-docker create data docker.eyeseetea.com/eyeseetea/dhis2-data:2.37.9-sierra

sudo d2-docker start docker.eyeseetea.com/eyeseetea/dhis2-data:2.37.9-sierra

An DHIS2 instance should be available at localhost:8080

Note that if you will try to run an image that has capital letters, in the latest docker version you can not do it. So try to rename the image and follow the naming convention of the latest docker version.