Configure containers.conf consistently

I am working with several Ubuntu distroboxes that need to be either Eastern (New York) or Central (Chicago) to avoid conflicting code when Windows inherits the time from distrobox.

So far I have tried the following without success:

  • Use Init with the distrobox, and then run dpkg-reconfigure tzdata
    • This works until the distrobox is shut down, then it resets to UTC
  • Create the distrobox with the added arguments -I -a “-–tzdata local”
    • This didn’t seem to work as the time was UTC when it booted
  • Edited /usr/share/containers/containers.conf
    • This file is locked, and thus I didn’t touch it to avoid breaking the image

Wondering if editing the other locations outlined in the first conf file would work, those being:

  1. /etc/containers/containers.conf
  2. $XDG_CONFIG_HOME/containers/containers.conf or $HOME/.config/containers/containers.conf if $XDG_CONFIG_HOME is not set

If not, is there another way to change the default time from UTC?

You should be able to use $HOME/.config/containers/containers.conf for user based configurations, and /etc/containers/containers.conf for system-wide configurations, depending on your use cases.

Generally, configurations under /usr will be the default config files and are used if you don’t have anything under /etc or ~/.config. I’m also fairly certain that the order in which the configuration files are read is

  1. /usr/share/containers/containers.conf
  2. /etc/containers/conatiners.conf
  3. $HOME/.config/containers/containers.conf
    with configuration line items in the latter overriding values of the previous .conf file, if they exist.

Edit: The containers.conf manpage has some additional information and options for adjusting your configurations.