[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [atomic-devel] Changing /etc/localtime with container images



On 07/12/16 22:14, Daniel J Walsh wrote:
> The following bugzilla shows a problem with containers.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1399749\\
> 
> People want to be able to volume mount in /etc/localtime into a
> container to change its TimeZone.  The problem is the way the kernel
> handles bind mounting symbolic links
> 
> On my host I have
> 
> ls -l /etc/localtime
> 
> lrwxrwxrwx. 1 root root 38 Dec  7 16:09 /etc/localtime ->
> ../usr/share/zoneinfo/America/New_York
> 
> In a Fedora container I have
> 
> ls -l /etc/localtime
> lrwxrwxrwx. 1 root root 25 Dec  7 21:08 /etc/localtime ->
> ../usr/share/zoneinfo/UTC
> 
> If you run a docker container like
> 
> 
> docker run -ti -v /etc/localtime:/etc/localtime:ro fedora bash
> 
> 
> You do not end up with /etc/localtime as a link pointing to New York,
> You end up with the
> 
> /usr/share/zoneinfo/New_York file mounted over the
> /usr/share/zoneinfo/UTC file.
> 
> IE the mount -o bind command follows both symbolic links.
> 
> This is causing issues with the java program inside the bugzilla.
> 
> The proposed fix is to change container images to
> 
> rm -f /etc/localtime
> 
> cp /usr/share/zoneinfo/UTC /etc/localtime
> 
> 
> Then if I do the command above
> 
> docker run -ti -v /etc/localtime:/etc/localtime:ro fedora bash
> 
> I end up with the /etc/localtime file inside of the container containing
> the content of the New_York file.
> 
> Does anyone object to this idea?
> 

Hi,

the name of the original file seems to be important. A lot of files in
/usr/share/zoneinfo/ differ only by their names but are otherwise
identical. For example Prague/Bratislava, Montreal/Toronto, ...
You still have the correct UTC offset but you do not know which place it
is. Timedatectl reports "n/a" after such manipulation. Java.time.ZoneId
picks some place with the correct UTC offset. It leads to confusing
behavior when a user tries to set timezone to some specific place and
the system reports a different place - and not even consistently.

Fero

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]