Search code examples
docker.net-coremicroservicesoracleclient

.Net core microservice from docker trying to access oracle database


I created a microservice that serves as a middleware between an application and the Oracle database. The application requests some data from the service and the services in turn connects to Oracle to fetch and pass back the requested data.

This works fine on the local environment. However ...

When I deploy the service on Docker Container (which is currently hosted on my machine), then the service does not work.

The code throws an exception at the oraclecon.Open() line. Following errors are thrown:

ORA-00604: error occurred at recursive SQL level 1 ORA-01882: timezone region not found

I am using Oracle.ManagedDataAccess.core library, version 3.21.61

Any idea why this could be happening please.

Thanks :)


Solution

  • I knew that the fix would be simple, but it took me some time to get there.

    I included the following code in the Dockerfile and boom ... things started working as expected.

    ENV TZ=Asia/India
    RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone