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/cacheHaven't tried but I think you should use same dir for these envvars.
In the following docs, we'll use
/opt/hostedtoolcachefor cache dir CI action use/home/user/cachefor 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/hostedtoolcachemount /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/cacheto volume setting indocker-compose.yml
Restart runner (and dind container if you're using it)