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.

  • docker exposing multiple ports - not working
  • Using the Erlang Observer App with a remote Elixir Phoenix server inside Docker
  • php-fpm child process exited on signal 11
  • Matplotlib building on docker
  • Allow redeploy for “latest” docker tag in Nexus OSS
  • Connection refused when accessing web app through Docker
  • 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?

  • Can't start docker-compose with systemd: “aufs au_opts_verify: dirperm1 breaks the protection by the permission bits on the lower branch” error
  • Command run on bash but not from nginx conf exec
  • Ahow to use multiple terminals in the docker container?
  • Wildfly: AMQ214016: Failed to create netty connect ion java.nio.channels.UnresolvedAddressException from client on natted network
  • How to avoid undesired “animated” console output on Jenkins
  • AWS + Docker + Puma + Rails + S3 , broken upload after few hours of uploading
  • 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.