R
Railway10mo 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
Percy10mo ago
Project ID: 87f6d50b-7bab-488e-b802-02f9edc442e3
SHxKM
SHxKM10mo ago
87f6d50b-7bab-488e-b802-02f9edc442e3
Brody
Brody10mo ago
the id is the service id, but I'll get you the correct format when I'm back at my computer
SHxKM
SHxKM10mo 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
Brody10mo ago
i mean theres not even a service id there
SHxKM
SHxKM10mo ago
You're correct, but specifying id without target doesn't help (no matter what the ID is)
Brody
Brody10mo ago
I'll get you the correct format when I'm back at my computer
Solution
Brody
Brody10mo 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
SHxKM10mo ago
Thanks Brody, trying to go a different way about this but this will surely come handy!
Brody
Brody10mo ago
no problem
SHxKM
SHxKM10mo ago
@Brody :
id=s/<service id>-
id=s/<service id>-
the s/ and the - are intetional, correct?
Brody
Brody10mo ago
yes
SHxKM
SHxKM10mo ago
Ahhh but unfortunately I'm using the same Dockerfile for two services...sigh
Brody
Brody10mo ago
might have to forgo the cache then
Want results from more Discord servers?
Add your server