wolfcw / libfaketime

libfaketime modifies the system time for a single application
https://github.com/wolfcw/libfaketime
GNU General Public License v2.0
2.64k stars 321 forks source link

Docker exited : ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD. #412

Closed hgb1995 closed 1 year ago

hgb1995 commented 1 year ago

Hi,

I want to run the containers with libfaketime. According to this link(https://hub.docker.com/r/trajano/ubuntu-faketime), I understand this flowing these steps.

  1. Add environment to docker-file "FROM alpine COPY --from=trajano/alpine-libfaketime /faketime.so /lib/faketime.so ENV LD_PRELOAD=/lib/faketime.so " Note : For Java, I attached that DONT_FAKE_MONOTONIC=1
  2. Then build dockerfile "docker build -f fakedemo.Dockerfile. -t fakedemo"
  3. Add specific faketime configuration as the environment when running docker "docker run --rm -e FAKETIME=+15d fakedemo date"

But some containers do not run successfully. When the 1 and 2 steps apply to the docker file, all docker files are built successfully. But when I run the container, the container immediately exited. According to the docker log:

ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.

I don't understand, I try some solutions from forum sites. But I can't solve the problem. Do you have any ideas about this problem?

Thank you,

wolfcw commented 1 year ago

I did not build that Docker image and don't know how current / up-to-date it is.

The error you get indicates that libasan is involved. libfaketime apparently does not work in conjunction with a few other preloaded libraries, such as jemalloc and libasan (see #130 and #365). There is no known solution for that, but it's not related to Docker.

Usually, you should try to get your program working with libfaketime on a regular system, and then it should also work within a container. I don't think your problem is related to Docker / running within a container at all.