Change container's year

Hi.

Setup

The problem
I can’t change the system year (I need to use 2049). How to do it? For now I only learned how to change the timezone, but I need to change the year.

I can’t change host time because I don’t have permissions.

There is no ‘time namespace’ in containers. https://en.wikipedia.org/wiki/Linux_namespaces#time_namespace

In other words, container and the host get time from the same kernel variables (without getting into how time imaintained).

But while you might not have direct privilege to change the time, your containers may have such depending on how docker is configured. A host may allow containers to run as uid 0 (root). If this is true for your environment, then you can avoid the privilege problem.

I’m not going to try it on my own system to confirm, but something like this can work on a host that allows containers to run as root:

docker run --rm alpine date 092010102018

Unsuccessful.

date: can’t set date: Operation not permitted