By default, cache location when running CI tasks is /opt/hostedtoolcache
. It's okay to change it by setting 3 envvars in config.yaml
runner:
envs:
RUNNER_TOOL_CACHE: /path/to/cache
AGENT_TOOLSDIRECTORY: /path/to/cache
RUN_TOOL_CACHE: /path/to/cache
Haven't tried but I think you should use same dir for these envvars.
In the following docs, we'll use
/opt/hostedtoolcache
for cache dir CI action use/home/user/cache
for cache dir on host machine
And all we gonna do is mapping /home/user/cache
to /opt/hostedtoolcache
You should stop runner first as we're gonna edit config.yaml
Add following to config.yaml
container:
options: "-v /home/user/cache:/opt/hostedtoolcache"
valid_volumes:
- /opt/hostedtoolcache
mount /home/user/cache
into dind container by
- If you use
docker run
, add-v /home/user/cache:/home/user/cache
- If you use
docker compose
, add- /home/user/cache:/home/user/cache
to volume setting indocker-compose.yml
Restart runner (and dind container if you're using it)