Modifying a Container Time-Zone
The default time-zone for any Docker container is UTC. In the case where you want the Docker container's time-zone to be in sync with the host machine's time-zone, you can apply these changes either in the Docker file or in the Docker-Compose YAML file.
Docker containers always use the system clock of the host machine but it sets its time-zone as UTC.
The following steps are an example of changing the time zone for an Order Management Server container.
- Procedure
- You can modify a container's time zone with either of the following two ways:
This approach can be applied when you have not created any images. Open the $OM_HOME/docker/orchestrator-service-context/6.1.0/Dockerfile in a suitable editor and modify the file as shown:
FROM tibco/base:1.0 COPY orchestrator $OM_HOME/orchestrator ENV TZ-Asia/Kolkata RUN ln -snf /user/share/zoneinfo/$TZ etc/localtime "echo $TZ > /etc/timezone RUN chmod 777 $OM_HOME/orchestrator/standalone/bin/* \ && chmod -R a+w $OM_HOME/orchestrator/standalone/logs \ && chmod -R a+w $OM_HOME/orchestrator/standalone/config
USER root ENTRYPOINT ["sh","-c", "$OM_HOME/orchestrator/standalone/bin/start.sh -XX:MinRAMPercentage=$min_ram_percentage -XX:MaxRAMPercentage=$max_ram_percentage --run=FG"]
EXPOSE 9093In this example, the following has been modified:
ENV TZ=Asia/Kolkata
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ /etc/timezone
Here you have to change the value of the
TZ
variable as per your time zone (in the example, the time zone is Asia/Kolkata).This approach can be applied if your images are already created and now you want to change the container time zone at runtime. Open $OM_HOME/docker/docker-compose-run-orchestrator-service.yml in a suitable editor and modify the file as shown:version: "3" services: tibco-orchestrator: image: "tibco/orchestrator:${OM_VERSION_TAG}" environment: min_ram_percentage: ${min_ram_percentage} max_ram_percentage: ${max_ram_percentage} ports: - "${HOST_ORCHESTRATOR_SERVICE_PORT}:9093" volumes: - "${HOST_LOG_ROOT_LOCATION_DIR_PATH}:/home/tibuser/tibco/
om/6.1/orchestrator/standalone/logs" deploy: resources: limits: cpus: '4' memory: 4G reservations: cpus: '0.2' memory: 512M environment: - "TZ=Asia/Kolkata" command: sh -c "ln -snf /user/share/zoneinfor/$TZ /etc/localtime && echo $TZ > /etc/timezone"In this example, the following has been modified:
environment: - "TZ=Asia/Kolkata"
command: > sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone"
Here you have to change the value of the
TZ
variable as per your time zone (in the example, the time zone is Asia/Kolkata).