Configure HostOS chrony from inside a container using chronyc and a mounted chrony socket

We are operating on an air-gapped network and on devices that may be unpowered for a while. They do not have an RTC with battery.
We are discovering a NTP server using Avahi from within a container and would like to configure that IP on the HostOS from within the container.

ChronyC seems to be able to (remotely) control the chrony daemon using either the network (with limited capabilities) or via a socket. I would like to use the latter. Is that something that you have had experience with? Can I simply add it as a volume or is there a specific balena tag that I need to use?

Thanks :slight_smile:

Hey, unfortunately setting the NTP servers at runtime is not currently supported. If this feature is important for your application I suggest you open an item in our public roadmap at

However, NTP provided via DHCP are picked up so I suggest you try that way which is more standard.

Hi @alexgg is there no way to bind the chronyd socket into a container? That would solve the issue.

Hey @rapha, not at the moment. However, you can always stop the hostOS chronyd via d-bus and provide the service from the application.

I’ve encountered an interesting issue while using ChronyC to control the chrony daemon within a container on an air-gapped network. Since the devices we work with may be unpowered for extended periods and lack an RTC with a battery, we need to configure the NTP server’s IP on the HostOS from within the container. I’m exploring the possibility of using the socket method to remotely control the chrony daemon, which seems promising for our use case. I’m unsure about the best approach to achieve this within the container. Should I simply add the socket as a volume, or is there a specific balena tag that I need to use to enable this functionality seamlessly?

Hey @Patrickard That was exactly what I had also hoped for. But from what @alexgg says, the hostOS’ chronyd socket is not available inside the container. Balena limits what sockets or other bind mounts are available inside containers. You need to use labels for the allowed binds: Multiple containers - Balena Documentation

We expose an image with this capability:

Please check the ‘advanced usage’ to leverage socket connections.

1 Like