Closed movermeyer closed 2 years ago
I reported this bug (?) upstream: https://bugs.launchpad.net/ubuntu/+source/tzdata/+bug/1899343
Is this still an issue? Because if it is I might just release a version that explicitly strips that infornation, but it's pretty silly to hack around a bug in a docker image config. :-)
@regebro I can still reproduce the issue using the steps listed in the issue I made upstream :
FROM ubuntu
RUN apt-get update && \
apt-get install -y tzdata
$ docker build --no-cache -t tztest .
$ docker run -it --rm=true tztest cat /etc/timezone
/UTC
An interesting question is what /etc/timezone is before the install of tzdata? I suspect it's non-existent, but perhaps not? The package install does read it, and there could be something going wrong there if it exists but with unexpected data...
I added a workaround in 4.0.1. Annoying since this is a trivial bug in the Ubuntu config, but I have no idea how to contribute, it's very confusing.
On the
ubuntu
Docker image, the contents of/etc/timezone
is/UTC
, which causes tzlocal to raise:Dockerfile that reproduces the issue
```dockerfile FROM ubuntu RUN apt-get update && \ apt install -y software-properties-common && \ add-apt-repository ppa:deadsnakes/ppa && \ apt-get update # Install Python 3 RUN apt install -y python python-dev && \ apt install -y python3.9 python3.9-dev python3.9-venv # Make Python3 the default `python` RUN ln -s /usr/lib/python3.9/_sysconfigdata__linux_x86_64-linux-gnu.py /usr/lib/python3.9/_sysconfigdata__x86_64-linux-gnu.py && \ update-alternatives --install /usr/bin/python python /usr/bin/python3.9 10 # Install pip RUN apt-get install -y git curl gcc build-essential && \ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ python get-pip.py # Get tzlocal RUN pip install tzlocal # Trigger the bug RUN python -c "from tzlocal import get_localzone; tz = get_localzone()" ```