extrange / ibkr-docker

Run IBKR Gateway/TWS in a Docker container
207 stars 41 forks source link

Setting localtime #79

Closed Dave3991 closed 9 months ago

Dave3991 commented 9 months ago

this is part of my docker-compose.yaml amd I'm getting error below, did anyone solve it? Host has right time.

  ibkr:
      image: ghcr.io/extrange/ibkr@sha256:905039e3388d10089b9d40bd33303e8eb9c261566f9b82357c0c739b82a236d6 # stable
      ports:
        - "127.0.0.1:6080:6080" # noVNC browser access
        - "127.0.0.1:8880:8888" # API access
      ulimits:
        nofile: 10000 # See FAQ
      environment:
        USERNAME: ${IBKR_USERNAME}
        PASSWORD: ${IBKR_PASSWORD}
      volumes:
        - /etc/localtime:/etc/localtime:ro
      restart: always

image

extrange commented 9 months ago

/etc/localtime is usually a symlink, e.g.:

❯ readlink /etc/localtime 
../etc/zoneinfo/Asia/Singapore

However in the docker container, that symlink is being overriden by something else (issue). Also, mounting symlinks in a container is problematic.

I suggest instead using a TZ environment variable; that way, you are guaranteed the same timezone no matter what host you run on.