3

I have *.yml file to keycloak example and when i want see logs in console then i use:

docker logs -f keycloak

example logs:

08:41:27,304 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final

When i go into docker

docker exec -it keycloak bash

and run date then i have correct time like

[root@3741ebb1131f /]# date
Mon Nov 14 14:44:41 CET 2016

My yml file:

version: '2'
services:
    keycloak:
        image: bla_bla_bla_image
        container_name: keycloak
        volumes:
          - /etc/localtime:/etc/localtime:ro
        external_links: 
          - postgres_container:postgres
        networks:
          default:
              ipv4_address: "111.111.11.11"

networks:
    default:
        external:
            name: demo

Can someone tell me what is happen?

qHulk
  • 31
  • 2
  • What platform are you running this on? Linux? Mac? Windows? – Horia Coman Nov 14 '16 at 15:36
  • My platform is Linux – qHulk Nov 14 '16 at 15:38
  • What does `docker logs --timestamps` says? It looks like a locale difference between JBoss and the rest of the system. – Nowhere man Nov 14 '16 at 15:39
  • `docker logs --timestamps` i get another different incorrect time like `2016-11-14T13:41:26.536890047Z` when actualy is 16:41 – qHulk Nov 14 '16 at 15:43
  • 1
    If your timezone is GMT+03:00, then this timestamp is perfectly correct. it's an ISO 8601 date, the `Z` at the end means Zulu time, or GMT. – Nowhere man Nov 14 '16 at 16:19
  • 1
    Also note that if your date says 14:41 CET (Central European Time, GMT+1) and JBoss says 8:41, then JBoss happens to tell the time as if its timezone were EST (Eastern Standard Time, Z-5), which is not an unusual default for software. – Nowhere man Nov 14 '16 at 16:28
  • There's helpful information about containers and timezones here: [Will docker container auto sync time with the host machine?](http://stackoverflow.com/questions/22800624/will-docker-container-auto-sync-time-with-the-host-machine) – Roman Nov 14 '16 at 16:31
  • I am faced this problem too. – allenchen Jul 04 '17 at 06:55
  • Did you found a solution? Stuck at the same problem.. – Dominic Jonas Jan 31 '19 at 11:09
  • Related to: https://stackoverflow.com/q/55466370/6064933. It seems that docker stores its log in UTC time format. Regardless of whatever time zone you use in your host and inside the docker container. – jdhao Mar 23 '21 at 07:58

0 Answers0