R
Railway5mo ago
SHxKM

Cache mounts MUST be in the format --mount=type=cache,id=<cache-id>

I'm getting this error while trying to cache downloading a somewhat challenging to cache pip package:
RUN \
--mount=type=cache,target=/var/cache/apt \
pip3 download https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.1/en_core_web_sm-3.7.1.tar.gz
RUN \
--mount=type=cache,target=/var/cache/apt \
pip3 download https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.1/en_core_web_sm-3.7.1.tar.gz
This runs file locally and the package isn't redownloaded, but it fails on Railway with:
Cache mounts MUST be in the format --mount=type=cache,id=<cache-id>
Cache mounts MUST be in the format --mount=type=cache,id=<cache-id>
Why is id mandatory, and why is it missing the target field?
Solution:
--mount=type=cache,id=s/<service id>-/root/cache/pip,target=/root/.cache/pip
--mount=type=cache,id=s/<service id>-/root/cache/pip,target=/root/.cache/pip
...
Jump to solution
14 Replies
Percy
Percy5mo ago
Project ID: 87f6d50b-7bab-488e-b802-02f9edc442e3
SHxKM
SHxKM5mo ago
87f6d50b-7bab-488e-b802-02f9edc442e3
Brody
Brody5mo ago
the id is the service id, but I'll get you the correct format when I'm back at my computer
SHxKM
SHxKM5mo ago
doesn't seem like I can use:
RUN \
--mount=type=cache,id=var/cache/apt \
pip3 download https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.1/en_core_web_sm-3.7.1.tar.gz
RUN \
--mount=type=cache,id=var/cache/apt \
pip3 download https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.1/en_core_web_sm-3.7.1.tar.gz
Because that wouldn't really cache it I guess...
Brody
Brody5mo ago
i mean theres not even a service id there
SHxKM
SHxKM5mo ago
You're correct, but specifying id without target doesn't help (no matter what the ID is)
Brody
Brody5mo ago
I'll get you the correct format when I'm back at my computer
Solution
Brody
Brody5mo ago
--mount=type=cache,id=s/<service id>-/root/cache/pip,target=/root/.cache/pip
--mount=type=cache,id=s/<service id>-/root/cache/pip,target=/root/.cache/pip
SHxKM
SHxKM5mo ago
Thanks Brody, trying to go a different way about this but this will surely come handy!
Brody
Brody5mo ago
no problem
SHxKM
SHxKM5mo ago
@Brody :
id=s/<service id>-
id=s/<service id>-
the s/ and the - are intetional, correct?
Brody
Brody5mo ago
yes
SHxKM
SHxKM5mo ago
Ahhh but unfortunately I'm using the same Dockerfile for two services...sigh
Brody
Brody5mo ago
might have to forgo the cache then