SBT uses ivy to resolve project dependencies. Ivy caches downloaded artifacts locally and every time it is asked to pull something, it first goes to that cache and if nothing found downloads from remote. By default cache is located in ~/.ivy2, but it is actually a configurable property. So just mount volume, point ivy to it (or mount it in a way it will be on default location) and enjoy the caches.

Not sure if this makes sense on an integration server, but when developing on localhost, I’m mapping my host’s .ivy2/ and .sbt/ directories to volumes in the container, like so:

docker run ... -v ~/.ivy2:/root/.ivy2 -v ~/.sbt:/root/.sbt ...

(Apparently, inside the container, .ivy2/ and .sbt/ are placed in /root/, since we’re logging in to the container as the root user.)