Advice on working with a "persistent" Julia Docker image

I am using Julia docker but I want to make the packages I install persist across sessions.

Is the best way to just mount a directory using the -v option and point Julia to that directory for all package installs?

e.g.

sudo docker run --rm -it  ~/julia-docker-pkgs:/root/.julia julia

Yes, I think so.
Otherwise you have no state and need to install them during the docker build.
But you won’t get to preserve any compile cache in that case,
so maybe you also precompile them duuring build,
or build a system image with them via PackageCompiler.jl