Trigger a chrony time sync from within the container

From the registry as part of my app using http://docker-py.readthedocs.io. Definitely not Balena related.

Thanks for the pointer on the chronyc sources. Ideally it would be better to trigger the sync and then wait for a reply, as using the grep option would require a loop to listen. I read about some methods using dbus (Chronyc config is bad if device comes online without internet - #27 by adamshapiro0) but it’s pretty complex for something quite simple. Shame to see that chronyc doesn’t seem to have anything like this in its CLI.

There is another potential issue, presumably once it has synced it will return a source for the sync every other time. But if there is clock drift while offline and then it comes back online, it will be out of sync again and yet my test will return that it is in sync.

I will keep playing around, but if any other ideas spring to mind on how to trigger the sync do let me know.

Another way to go which I am going to try and explore is not having the Balena-engine rely on the SSL for the registry (ubuntu - Docker pull error : x509: certificate has expired or is not yet valid - Stack Overflow). Perhaps even more complex though? It would be a better option though, as then the time sync plays no part and the user will always be able to pull from the registry at any time.

Full details from the docker-py end here: 404 on containers.create for valid images · Issue #2101 · docker/docker-py · GitHub