Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack

Documentation

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

An example of a working docker-compose file, save it as 'docker-compose.yml' file to any directory:

Code Block
languageyml
themeEclipse
titledocker-compose.yml
linenumberstrue
    version: '2.1'

  

services:
      openmrs-referenceapplication-mysql:
   
    restart: "always"
   
    image: mysql:5.6
  
     command: "mysqld --character-set-server=utf8 --collation-server=utf8_general_ci"
   
    environment:
   
      MYSQL_DATABASE: ${MYSQL_DB:-openmrs}
          MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-Admin123}
   
      MYSQL_USER: ${MYSQL_USER:-openmrs}
   
      MYSQL_PASSWORD: ${MYSQL_PASSWORD:-Admin123}
  
     healthcheck:
   
      test: "exit 0"
   
    volumes:
  
      -  openmrs-referenceapplication-mysql-data:/var/lib/mysql  

 

   openmrs-referenceapplication:
   
    restart: "always"
   
    image: openmrs/openmrs-reference-application-distro:${OPENMRS_VERSION:-demo}
  
     depends_on:
   
      - openmrs-referenceapplication-mysql
  
     ports:
          - "8080:8080"
  
     environment:
          DB_DATABASE: ${MYSQL_DB:-openmrs}
   
      DB_HOST: openmrs-referenceapplication-mysql
  
       DB_USERNAME: ${MYSQL_USER:-openmrs}
          DB_PASSWORD: ${MYSQL_PASSWORD:-Admin123}
   
      DB_CREATE_TABLES: 'true'
  
       DB_AUTO_UPDATE: 'true'
   
      MODULE_WEB_ADMIN: 'true'
   
    healthcheck:
  
       test: ["CMD", "curl", "-f", "http://localhost:8080/openmrs/"]
          timeout: 20s
   
    volumes: 
   
      - openmrs-referenceapplication-data:/usr/local/tomcat/.OpenMRS/
   
      - /usr/local/tomcat/.OpenMRS/modules/ # do not store modules in data
  
       - /usr/local/tomcat/.OpenMRS/owa/ # do not store owa in data

 

volumes:
   
   openmrs-referenceapplication-mysql-data:
	   openmrs-referenceapplication-data:


Make sure you have a _docker-compose.yml` file on the current directory:


Code Block
bash
bash
# To start database and OpenMRS with default credentials:
$ docker-compose up -d

# To override credentials, use environments variables
$ MYSQL_DB=my_database MYSQL_ROOT_PASSWORD=my_root_password MYSQL_USER=my_user MYSQL_PASSWORD=my_password docker-compose up -d

# To see logs
$ docker-compose logs -f

# Bring containers down
$ docker-compose down

# Bring containers down and delete all the data

$ docker-compose down -v

...