Docker Community Forums

Share and learn in the Docker community.

Can libfaketime work in real-time when env arg FAKETIME is modified in docker container?

I introduced libfaketime into my docker images, which is a springboot application or a mysql instance

COPY --from=forlabs/libfaketime /faketime.so /lib/faketime.so
ENV LD_PRELOAD=/lib/faketime.so DONT_FAKE_MONOTONIC=1

it works fine when I modify the env arg FAKETIME before running docker container

but after the docker container starts running, I log inside the container, and modify the env arg FAKETIME, it seems to work in the linux system inside the docker container, coz if I type date, it shows as expected. But the timing of the springboot application or mysql instance, which runs over the linux system inside the container, remains as the same as when the container starts, it is not in sync with the linux system.

What is wrong?

Changing an environement variable only change your current process version of that variable. The other process inside the container are not affected by your change. you will need to restart the process with the new variable setup.