How do I change my time zone in my docker installation on Linux?

How do I change my time zone in my docker installation of OpenEMR 7 on Linux Mint?

Many thanks.

Nobody knows how to do this?

I can tell you how I did it with google cloud and just other dockers. When starting the docker, they have an option for Environmental Variables. For name I entered “TZ” and for value I put “America/Indiana/Knox”.

It’s not an answer to your question but maybe it’ll put you in the right direction to research.
I wish I had an exact answer for you.

1 Like

you have to edit the php.ini inside of the docker @rdh61 and find the date.timezone = setting and uncomment it by removing the ; and enter your timezone, save the file and restart the docker

Thank you for trying!

Thank you. I have a number of different php.ini files/locations. Which one do I need to change?

php.ini 69.3 kB /home/robert/Downloads/openemr/ci/nginx_74 
php.ini 69.3 kB /home/robert/Downloads/openemr/ci/nginx_80 
php.ini 69.3 kB /home/robert/Downloads/openemr/ci/nginx_81 
php.ini 69.3 kB /home/robert/Downloads/openemr/ci/nginx_82 
php.ini 72.0 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-5-6 
php.ini 72.0 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-5-6-redis 
php.ini 69.3 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-7-0 
php.ini 69.4 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-7-0-redis 
php.ini 69.3 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-7-1 
php.ini 69.4 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-7-1-redis 
php.ini 69.3 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-7-2 
php.ini 69.4 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-7-2-redis 
php.ini 69.3 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-7-3 
php.ini 69.4 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-7-3-redis 
php.ini 69.3 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-7-4 
php.ini 69.4 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-7-4-redis 
php.ini 69.3 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-8-0 
php.ini 69.4 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-8-0-redis 
php.ini 69.3 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-8-1 
php.ini 69.4 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-8-1-redis 
php.ini 69.3 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-8-2 
php.ini 69.4 kB /home/robert/Downloads/openemr/docker/library/dockers/dev-php-fpm-8-2-redis

hi @rdh61 , have to get into the docker and find and edit something like /etc/php81/php.ini. You can list it with ls /etc/php*

If his docker instance is restarted, wouldn’t that loose any changes to the php.ini file? or is it stored on a stateful volume somewhere?

hi @brad, nope , it restarts the container and any processes running and has no effect on volumes

Hi @stephenwaite , unfortunately I am really unsure how to resolve your instruction to “get into docker” with the content of the link you provide, which goes to this:

we can try debugging by using the nano text editor which is hopefully installed in your docker

  1. logout of openemr
  2. in terminal : docker exec -it $(docker ps | grep _openemr | cut -f 1 -d " ") nano src/Common/Crypto/CryptoGen.php
  3. hold the <Ctrl> key and hit the / (forward slash)
  4. type 466 and hit enter to go to that line #
  5. insert this debugging line above that line
error_log("about to decrypt drive key " . file_get_contents($GLOBALS['OE_SITE_DIR'] . "/documents/logs_and_misc/methods/" . $label));
  1. <Ctrl> x to save, Y to save modified buffer, enter to use the file name
  2. refresh openemr login page ( this will look for keys)
  3. back to terminal and look in error log with this command
docker exec -it $(docker ps | grep _openemr | cut -f 1 -d " ") tail /var/log/apache2/error.log

I’m assuming you want me to use some part of the command in point 2. But what part? And then?

Thanks again.

hi @rdh61 , was meant to be vague :slight_smile:

what do you think you should try?

Among various other things, I tried the following:

robert@robert-Lenovo-B590:~$ docker exec -it $(docker ps | grep _openemr | cut -f 1 -d " ") ls /etc/php*
ls: /etc/php*: No such file or directory
robert@robert-Lenovo-B590:~$

nice, try

docker exec -it $(docker ps | grep _openemr | cut -f 1 -d " ") ls /etc
robert@robert-Lenovo-B590:~$ docker exec -it $(docker ps | grep _openemr | cut -f 1 -d " ") ls /etc
ImageMagick-7         issue                 periodic
alpine-release        letsencrypt           php8
apache2               login.defs            pkcs11
apk                   logrotate.d           profile
ca-certificates       modprobe.d            profile.d
ca-certificates.conf  modules               protocols
conf.d                modules-load.d        resolv.conf
cron.d                motd                  rsyncd.conf
crontabs              mtab                  securetty
default               my.cnf                security
environment           my.cnf.d              services
fonts                 mysql                 shadow
fstab                 nanorc                shadow-
group                 network               shells
group-                openldap              ssl
hostname              opt                   ssl1.1
hosts                 os-release            sysctl.conf
init.d                pam.d                 sysctl.d
inittab               passwd                terminfo
inputrc               passwd-               udhcpd.conf
robert@robert-Lenovo-B590:~$
1 Like

I can probably work out what to do next.

1 Like

This command allowed me to edit the php.ini file:

docker exec -it $(docker ps | grep _openemr | cut -f 1 -d " ") nano /etc/php8/php.ini

I uncommented the “date.timezone =” setting and entered my timezone (Europe/Madrid).

OpenEMR now shows the time of my encounters correctly.

2 Likes

Is there a way to do this via the app, Administration section?

yeah, of course @dave929 , good point and could’ve saved some effort here by changing the timezone in Locale

1 Like