At the moment, state (persistence and lock file) are stored in the same folder which sometime can cause issues separating concerns in docker for example.
Maybe using the XDG Base directory speciation if these variables are set in the users environment?
https://specifications.freedesktop.org/basedir-spec/latest/