Ubuntu timedatectl fails in Docker container

I’ve got Ubuntu 16.04 LTS running in a Docker container (hosted on macOS). The date/time is off by about four days.

$ cat /etc/*-release
$ date
Sun May  7 05:57:21 UTC 2017

Effective date is 11 May 2017 06:17:13 UTC.

  • Java ee api gets 404 on payara production server
  • Disable AppArmor for Docker for ptrace_scope
  • How to stop docker
  • slow or timeout of dns resolving inside docker
  • Can we create a node group in docker swarm?
  • Consul-Agent architecture .. the node-id issue after upgrading to 0.8.1 - conceptual issue?
  • I wanted to fix this (checking this and this) but I can’t even run timedatectl:

    $ timedatectl status
    Failed to create bus connection: No such file or directory

    How do I fix this?

  • Dockerhub automated build: BitBucket repository with private submodules
  • Is it possible to execute CMD at the middle of docker file?
  • How can you make the docker container use the host machine's /etc/hosts file?
  • Dockerfile Build Error
  • Not dockerized nginx load balancing to gitlab dockerized
  • golang:sshfs -o reconnect fails when used inside docker container with “reading directory .: Input/output error”
  • One Solution collect form web for “Ubuntu timedatectl fails in Docker container”

    Time drift is caused by the underlying host OS which, for Docker, isn’t macOS but actually the Linux VM running on macOS. It’s related to macOS sleep times (e.g. when you close the MacBook lid). Apparently it’s recently been fixed and should be available soon: https://github.com/docker/for-mac/issues/17#issuecomment-300734810

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.