Wiki Spaces
Documentation
Projects
Resources
Get Help from Others
Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack
Docker is a unique container/image based platform made to let people distribute applications easily.
Our official images are deployed to Docker Hub.
Those images are automatically generated, and all our test environments are using them.
If you are interested in running the reference application with demo data (like https://demo.openmrs.org), check demo repository, as it contains the demo data as well.
See Docker Installation Instructions for your environment. If running on Linux, check https://docs.docker.com/compose/install/ to install docker compose.
docker -v
Docker should report its version number, which should be 1.5.0 or higher. If you get an error message, then you haven't gotten Docker installed properly; go back through the installation process and/or Google for solutions.
This is not the recommended approach. We recommend using docker-compose (manually created or using the SDK) whenever possible.
Check the build-distro
command in our SDK.
You can use the SDK to generate the docker-compose files.
Check build-distro on how to generate the docker-compose files (or copy from some of our test OpenMRS instances).
An example of a working docker-compose file:
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} ports: - "3306:3306" healthcheck: test: "exit 0" volumes: - openmrs-referenceapplication-mysql-data:/var/lib/mysql openmrs-referenceapplication: restart: "always" image: openmrs/openmrs-reference-application-distro: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:
# 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
You should be able to access in your browser http://localhost:8080/openmrs/
When the installation wizard is finished, you should be redirected to the login screen.
Username: admin
Password: Admin123
When running on Linux, it should be trivial to create backups of the docker volumes (there's a folder named 'volumes' inside your docker folder installation).
If you don't want to run MySQL in docker (or on the same machine), delete the 'openmrs-referenceapplication-mysql' service and check docker image to configure the right environment variables for OpenMRS.
5 Comments
Stefan Buttigieg
Burke Mamlin - I've been trying to run OpenMRS in the background but somehow never get to the stage where OpenMRS is installed on the droplet.
It seems as if it's managing to pull in the repository but not installing it
Error Logs:
root@xxxxxxopenmrs:~# docker logs openmrs
Starting MySQL database server: mysqld ..
Checking for tables which need an upgrade, are corrupt or were
not closed cleanly..
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
/root/run.sh: line 7: /etc/init.d/tomcat7: No such file or directory
tail: cannot open `/var/log/tomcat7/catalina.out' for reading: No such file or directory
Burke Mamlin
There was a typo in the
Dockerfile
. I fixed it and it should work better for you now. You'll want to remove any container & image before trying again.Remove (-f to force, even if it's running) any container named openmrs:
Remove the image:
Then you can try running in the background again.
Laurie Heer
Thank you, Burke. I just tried and received the very same error. Running on EC2 Amazon Linux instance.
user-a0165
What if root has password, is it gonna the same command?
docker run -it --
rm
-p 80:8080 burke
/openmrs-core-docker
Burke Mamlin
Currently, the openmrs-core-docker build includes MySQL, sets the database user=root and password=test in the build, and is not designed to take any parameters for using different credentials. When we get a chance to improve it, a better approach (following Docker's best practice of one app per container) would be to take MySQL out of this container and, instead, expect a MySQL container to be linked & credentials passed in the environment via parameters.