Db2

 View Only

Changing CURRENT TIMEZONE in db2 luw docker container

  • 1.  Changing CURRENT TIMEZONE in db2 luw docker container

    Posted Fri July 26, 2019 11:32 AM
    Hi All,
    There was a question on @IBM_Db2luw twitter handle,
    Q. Is there a way to change the current timezone in Db2 luw docker container?
    Answer: Yes.
    Here is how to do it -
    - Open your terminal and make sure your Db2 container is running. Then

    Step 1: List all the available timezone
    docker exec -it <CONTAINER ID> bash -c "ls -al /usr/share/zoneinfo/*"​
    ​Step 2: Move the local timezone file in the container to a backup file, in case you need it later.
    docker exec -it <CONTAINER ID> bash -c "mv /etc/localtime /etc/localtime.backup"​

    Step 3: Copy the required timezone file into the proper location in Db2 Container /etc/localtime folder
    docker exec -it <CONTAINER ID> bash -c "ln -s /usr/share/zoneinfo/Brazil/West /etc/localtime"​
    In the above example, we are replacing the localtime with following timezone.
    /usr/share/zoneinfo/Brazil/West​

    Happy Hacking!

    ------------------------------
    VINAYAK AGRAWAL
    ------------------------------

    #Db2