×
Community Blog Install DHIS2 on Docker Container on Alibaba Cloud ECS

Install DHIS2 on Docker Container on Alibaba Cloud ECS

This article explains how to install DHIS2 on a Docker container in a few easy steps using an Alibaba Cloud ECS instance.

By Grace Amondi, Alibaba Cloud Community Blog author

There are currently two ways of installing DHIS:

  1. On a Docker Container
  2. On a Tomcat-user. To read this instead go to https://alibabacloud.com/blog/deploy-dhis2-on-alibaba-cloud-ecs-instance_594616

This article explains how to install DHIS2 on a Docker container in a few easy steps using Alibaba Cloud's Elastic Compute Service (ECS). For more information about DHIS2 visit the official guide: DHIS 2 User guide

Step 1: Install Docker

If you already have docker and docker-compose installed then skip step 1 and 2. In this tutorial I will be working with Ubuntu version Xenial 16.04 (LTS). In case you are working with a different version or OS then visit the link below.

Docker Engine

Install using the repository

Before you install Docker Engine - Community for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.

Update the apt package index:

$ sudo apt-get update

Install packages to allow apt to use a repository over HTTPS:

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

Add Docker's official GPG key:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Use the following command to set up the stable repository.

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

Install Docker Engine-Community

Update the apt package index.

$ sudo apt-get update

Install the latest version of Docker Engine - Community and containerd, or go to the next step to install a specific version:

$ sudo apt-get install docker-ce docker-ce-cli containerd.io

Verify that Docker Engine - Community is installed correctly by running the hello-world image.

$ sudo docker run hello-world

Step 2: Install Docker Compose

Run this command to download the current stable release of Docker Compose:

$ sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

To install a different version of Compose, substitute 1.24.1 with the version of Compose you want to use.

If you have problems installing with curl, see Alternative Install Options tab above.

Apply executable permissions to the binary:

$ sudo chmod +x /usr/local/bin/docker-compose

Note: If the command docker-compose fails after installation, check your path. You can also create a symbolic link to /usr/bin or any other directory in your path.

For example:

$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Optionally, install command completion for the bash and zsh shell.

Test the installation.

$ docker-compose --version

Step 3: Clone DHIS2 Source Code

Run the following command:

$ git clone https://github.com/pgracio/dhis2-docker.git

then change directory to the project:

$ cd dhis2-docker

Step 4: Run DHIS2

execute docker-compose with the default config, Sierra Leone dataset, or use docker-compose-empty-db.yml

if you want to start with a clean state.

$ docker-compose up -d

or

$ docker-compose -f docker-compose-empty-db.yml up -d

Once the container is up, open url http://:8085 and connect using username admin and password district as explained in the dhis2 documentation

When running on Mac OS X or Windows pointing to localhost will fail. It fails because the Docker Host address is not the localhost but instead the address of docker host VM. Run $ docker-machine ip default to get Docker Host address.

Application Logs

To access application logs run docker-compose logs -f.

0 0 0
Share on

Alibaba Clouder

2,599 posts | 764 followers

You may also like

Comments