Hi @Kacper !
There might be a way to help you. Please try the following.
- Download the default seccomp file from Docker:
wget https://raw.githubusercontent.com/moby/moby/master/profiles/seccomp/default.json -O /etc/docker/seccomp/time.json
- Edit the file to add the
clock_settime64
syscall to it.
...
"names": [
"settimeofday",
"stime",
"clock_settime",
"clock_settime64"
],
"action": "SCMP_ACT_ALLOW",
...
- Start the container with this seccomp file, and the
SYS_TIME
capability.
$ docker run -it --cap-add=SYS_TIME --security-opt seccomp=/etc/docker/seccomp/time.json torizon/debian:2-bullseye
root@ddce364a7c52:/# date +%T -s "11:23:00"
11:23:00
root@ddce364a7c52:/# date
Those steps might help you to set the time from within a container without the need to deal with:
- systemd,
- root user, or
- privileged container
Let me know if it works for you.
Best regards,