# Advice on working with a "persistent" Julia Docker image

**URL:** <https://discourse.julialang.org/t/advice-on-working-with-a-persistent-julia-docker-image/30574>\
**Category:** General Usage\
**Created:** [November 1, 2019, 4:33am UTC](https://discourse.julialang.org/t/advice-on-working-with-a-persistent-julia-docker-image/30574 "2019-11-01T04:33:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [November 1, 2019, 4:33am UTC](https://discourse.julialang.org/t/advice-on-working-with-a-persistent-julia-docker-image/30574/1 "2019-11-01T04:33:07Z")

</div>

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.

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

```

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [November 1, 2019, 12:27pm UTC](https://discourse.julialang.org/t/advice-on-working-with-a-persistent-julia-docker-image/30574/2 "2019-11-01T12:27:32Z")

</div>

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
