ok, next really cool thing to showcase the OpenEMR docker (for that 1 person whom clicked on the above link )
This time, we will go straight to labs.play-with-docker.com ( (11/23/17 edit: you now need to login to use this site; you need to create an account at https://hub.docker.com/ and then use these credentials to log into labs.play-with-docker.com)). Then click ‘Add New Instance’ at the left and a new shell will open for you. Then copy/paste the four commands below:
docker network create mynet
docker run --detach --name mysql --env "MYSQL_ROOT_PASSWORD=root" --net mynet mysql --character-set-server=utf8
docker run --detach -p 81:80 --name phpmyadmin --env "PMA_HOST=mysql" --net mynet phpmyadmin/phpmyadmin
docker run --detach -p 80:80 --name openemr --env "MYSQL_HOST=mysql" --env "MYSQL_ROOT_PASS=root" --net mynet openemr/openemr
Let this go for about 4-5 minutes. After that time, click on the ‘
81’ link at the top, and it will take you to phpmyadmin (root:root credentials) and you can see the openemr database there. And then click on the ‘
80’ link at the top, and it will take you to the OpenEMR login screen(admin:pass credentials). So you can now play around with OpenEMR and the database anywhere you have access to a web browser!
To break down the above 4 commands above. First command sets up the network that the 3 dockers will use so they can communicate. Second command runs the mysql docker. Third command runs the phpmyadmin docker. Fourth command runs the openemr docker.
To see the 3 running dockers type ‘
docker ps -a’.
You can also stop and start the dockers. For example, ‘
docker stop openemr’ will stop the openemr docker while
'docker start openemr' will then restart the openemr docker.
ok, now you may get greedy and want another separate openemr docker going. can do this by running another openemr docker (this time will take advantage of the environment variables to ensure the sql database and sql user do not conflict with the current openemr docker):
docker run --detach -p 82:80 --name openemr_2 --env "MYSQL_HOST=mysql" --env "MYSQL_ROOT_PASS=root" --env "MYSQL_USER=openemr_2" --env "MYSQL_PASS=openemr_2" --env "MYSQL_DATABASE=openemr_2" --net mynet openemr/openemr
(again, give it a couple minutes to go through the automated install/configure process) After couple minutes, then click on the
'82' link to go to the new openemr instance you just created.
Again, type ‘
docker ps -a’ in the shell to see the active dockers (ie. containers). And type ‘
docker images’ to see the images that these containers are derived from.
Note that the second openemr container you started is using the current mysql container (can see the database in phpmyadmin). If looking for a little challenge (and will help further learn how cool dockers are), could try the following exercise:
Create another separate mysql container and then create another openemr container that uses it. And then create another phpmyadmin container that connect to the separate mysql container.(hint: do not create another network; this can be done by just using appropriate --env and --name settings)