Docker installation instruction on Linux Ubuntu

OpenEMR - Docker installation instruction on Linux Ubuntu 18.04.

Step 1: Install Dependency packages

sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common

Step 2: Add Docker’s official GPG key:

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

Step 3: Add the Docker repository

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(. /etc/os-release; echo "$UBUNTU_CODENAME") stable"

The command above will add a new line to additional repositories file.

cat /etc/apt/sources.list.d/additional-repositories.list
deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable

In this step we got error message
nerik@nerik-2060:~$ deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable

Command ‘deb’ not found, did you mean:

command ‘den’ from snap den (1.2.0-0)
command ‘dub’ from snap dub (1.18.0)
command ‘edb’ from deb edb-debugger
command ‘dex’ from deb dex
command ‘derb’ from deb icu-devtools
command ‘deb3’ from deb quilt
command ‘dep’ from deb go-dep
command ‘debc’ from deb devscripts
command ‘debi’ from deb devscripts
command ‘xdeb’ from deb xdeb
command ‘dub’ from deb dub
command ‘dab’ from deb bsdgames

See 'snap info ’ for additional versions.

Need help for this step!!

sudo apt install docker

This command is not listed in instruction, posted by Brady. Is it need to be posted before step 1 or after?

Couple references to derive below instructions for Ubuntu 18.04 (not tested):
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04
https://phoenixnap.com/kb/install-docker-compose-ubuntu
Release 1.25.4 · docker/compose · GitHub

From that would be:

sudo apt update
sudo apt upgrade
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce
sudo usermod -aG docker $USER
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

1 Like

Ok, I did everything by this instruction, no any errors.
Added codes for OpenEMR
Got good outcome message, looks perfect.

After 20 min started OpenEMR

Just need more information how to downgrade to 5.0.1. and restore data from our system.

Steps for Installing OpenEMR – Docker on Ubuntu 18.04

sudo apt update
sudo apt upgrade
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce
sudo usermod -aG docker $USER
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
mkdir testopenemr
cd testopenemr
wget https://gist.githubusercontent.com/bradymiller/8f8dc5215b07d287f7dc0fed80bf2b9d/raw/9b2a762849bbf8ce0a0d4dff30c4a359cfa88a44/openemr-502-docker-example-docker-compose.yml
mv openemr-502-docker-example-docker-compose.yml docker-compose.yml
docker-compose up -d
docker logs testopenemr_openemr_1

Then wait 10-15 minutes
then go to http://localhost 5
(you should see the login screen)

1 Like

I did step by step installation couple time, and it’s works without any problems, and I posted tested step by step instruction in this post.
But, it only for test version, not the stable one. Every time we logout from computer, its stops running, and we need to input codes to terminal again, to restart it.
I also need some information how to restore my uploaded data to docker.

Hi @ncavalier ,
I just linked to this thread from the main Docker thread. Recommend starting another thread regarding upgrade, so will then have a nice thread documenting that.
thanks,
-brady

Also, regarding it stopping. It should always run while the computer is on and even restart during a computer shutdown/restart etc. The setting that sets this in the docker-composer.yml that does that is here:
https://gist.github.com/bradymiller/8f8dc5215b07d287f7dc0fed80bf2b9d#file-openemr-502-docker-example-docker-compose-yml-L17

Hi Brady,
Do you have any link to information how to restore my data to docker OpenEMR.

Hi @ncavalier ,

Overall will look something like:

  1. Install 5.0.1
mkdir testopenemr
cd testopenemr
wget https://gist.githubusercontent.com/bradymiller/b629738d5d9aee6c2e8c036e7916c719/raw/1e5b63b3963334a11c7d54e6c466cbf9197ac4ff/openemr-501-docker-example-docker-compose.yml
mv openemr-501-docker-example-docker-compose.yml docker-compose.yml
docker-compose up -d

(NOTE that above is installing OpenEMR 5.0.1!)

  1. Copy files. Will be copying the sites directory from your current install (5.0.1) into the sites directory of the docker.
  2. Copy database. Will dump your current database into a file. Then will truncate (ie. clear it) the database on the docker. Then will import the database from the file into the docker.
  3. Then will edit the docker-compose.yml file and change the 5.0.1 to a 5.0.2.
  4. Then will run docker-compose up -d and viola then magic will happen with 5.0.1 being upgraded to 5.0.2 in several seconds

This gives you a general idea. Step 1 is done from above. Now we need to work on the other steps, which can all be done via command line :slight_smile:

And will get to learn some good commandline skillsets (doing mysqldump and import, copying files into a docker, running commands in the docker without even going into the docker; very fun stuff). First steps are to ensure you have access to your sites directory in your current OpenEMR and what OS your current OpenEMR is in. Just let me know these things.

-brady

2 Likes

Hi Brady, I played around with openemr 502 on docker and removed and installed again it works very good, But when tried to install ver 501 ( the code you provided) returned error result - could you please check if you posted correct address for ver 501. thanks Robert.

Hi @robikny ,

I confirmed above code works for 501. Ensure you aren’t using a port in the docker-compose.yml that is conflicting with a already used port. If still issues, then post the error here.

thanks,
-brady

Thanks Brady it works well.
I tried to put patch 7 on 501 because it has patch 6 - in order to upgrade to 502 all patches should be installed. Could not do it. I think it would be good idea to post along that how to install docker compose to post how to patch database, how to restore and how to upgrade on the docker.

Hi Brady
I did successfully installation of 5.0 1. (6)
Your instruction works perfectly, no any errors.
Next step need more detailed information about restoring tar file.

Tried post below to restore tar. file but got an error after second step

hi @robikny ,

There is documentation for patches and upgrades on docker:
openemr-devops/patch.md at master · openemr/openemr-devops · GitHub
openemr-devops/upgrade.md at master · openemr/openemr-devops · GitHub

-brady

hi @ncavalier ,

Rather than rely on that tar, would actually be best to bypass that and get the files and database directly from the source (the original openemr instance), since the Backup within OpenEMR is not perfect (for example, it can have issues when the database/instance is too large).

-brady

Hi Brady - how to pull correct instance - have problem to process patch update.