Can I change temporally the date to a LXC Container for test purposes?

ramses

Active Member
Dec 2, 2013
33
7
28
Hi everyone,

I need to change temporally the date to a LXC Container but when I execute the command "date -s 2018-03-01" it show me this error message:

-----------------------------------------------------------
root@test:/# date -s 2018-03-01
date: cannot set date: Operation not permitted
Thu Mar 1 00:00:00 CET 2018
root@pbx:/# date
Thu May 10 19:57:42 CEST 2018
root@test:/#
-----------------------------------------------------------

And not change the date.

I have read in some forums that the date in the LXC containers can't be changed.

Is this totally true?

I can't change the date to a LXC Container to, by example, 2018-03-01 temporally?


Regards,

Ramses
 
Hi everyone,

I need to change temporally the date to a LXC Container but when I execute the command "date -s 2018-03-01" it show me this error message:

-----------------------------------------------------------
root@test:/# date -s 2018-03-01
date: cannot set date: Operation not permitted
Thu Mar 1 00:00:00 CET 2018
root@pbx:/# date
Thu May 10 19:57:42 CEST 2018
root@test:/#
-----------------------------------------------------------

And not change the date.

I have read in some forums that the date in the LXC containers can't be changed.

Is this totally true?

I can't change the date to a LXC Container to, by example, 2018-03-01 temporally?


Regards,

Ramses

you could try "faketime" if all you want is to run a certain program with a different "time"