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.

  • Is there an official Docker Engine security notices mailing list or other channel?
  • Docker : Drupal container linked to mysql container can't connect to mysql during Drupal installation
  • How do I get a Docker Gitlab CI runner to access Git on its parent host?
  • Docker-Compose Up Works but Eb Local Run does not
  • Jenkinsfile custom docker container “could not find FROM instruction”
  • Docker error: client and server don't have same version
  • 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?

  • Cannot install perl module PerlIO::locale within docker
  • How to install extension for php via docker-php-ext-install?
  • How to check if the docker image has all the files?
  • Can not access wordpress configured in Docker even though its status is running
  • How can I determine if a specific tag is available for an image
  • Why can't I access a host port from my Docker container?
  • 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.