Oracle Timestamp Docker – Fixing Timestamp Sync Issues in Docker for Oracle

dockeroracletimestamp

I have created an Oracle Database Docker Image with the help of this link

SYSTIMESTAMP shows UTC time and not my local machine's time.

kaushik:~ knayak$ date
Fri Jun  8 17:46:35 IST 2018

select current_timestamp,systimestamp from dual;

CURRENT_TIMESTAMP                           SYSTIMESTAMP                      
------------------------------------------- ----------------------------------
08-06-18 05:47:51.742216000 PM ASIA/KOLKATA 08-06-18 12:17:51.742211000 PM GMT

How can I change the container's time to match with my time zone?

Best Answer

The problem is not with your database, it is the problem of the docker.

Docker has notorious problems with the time synchronization between the host machine and the virtual machines ("containers"...).

The simplest solution for the problem if you start the docker container with admin privileges (--privileged flag to docker run), and then use a time synchron tool inside the container to fix its time (ntpdate -s your.country.clock).