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

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



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?


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