Error: Cache mount ID is not prefixed with cache key

jp-cc-projects
HOBBY

a year ago

I'm using a Dockerfile to build my Maven project but I cant' get past the error: "Cache mount ID is not prefixed with cache key". I want my app to run on a Tomcat servlet.

Would appreciate help on this. Here's my Dockerfile:

FROM tomcat:10.1-jdk21-temurin

ARG RAILWAYPUBLICDOMAIN
ARG RAILWAYPRIVATEDOMAIN
ARG RAILWAYPROJECTNAME
ARG RAILWAYENVIRONMENTNAME
ARG RAILWAYSERVICENAME
ARG RAILWAYPROJECTID
ARG RAILWAYENVIRONMENTID
ARG RAILWAYSERVICEID

ENV RAILWAYPUBLICDOMAIN=$RAILWAYPUBLICDOMAIN \
RAILWAYPRIVATEDOMAIN=$RAILWAYPRIVATEDOMAIN \
RAILWAYPROJECTNAME=$RAILWAYPROJECTNAME \
RAILWAYENVIRONMENTNAME=$RAILWAYENVIRONMENTNAME \
RAILWAYSERVICENAME=$RAILWAYSERVICENAME \
RAILWAYPROJECTID=$RAILWAYPROJECTID \
RAILWAYENVIRONMENTID=$RAILWAYENVIRONMENTID \
RAILWAYSERVICEID=$RAILWAYSERVICEID

RUN rm -rf /usr/local/tomcat/webapps/*

RUN echo $RAILWAYSERVICENAME

COPY target/CCODE.pattern.rest.war /usr/local/tomcat/webapps/ROOT.war

WORKDIR /app

COPY . /app

RUN apt-get update && \
apt-get install -y maven && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN --mount=type=cache,id=s/b4d5caca-d379-4c7c-a78d-10725c38dd97-maven,target=/root/.m2 \
mvn -DskipTests clean install

EXPOSE 8080

CMD ["catalina.sh", "run"]

View Deploy details

ⓘ Deployment information is only viewable by Project members and Railway admins.

Solved

6 Replies

jp-cc-projects
HOBBY

a year ago

Here's the error message:

Attachments


jp-cc-projects
HOBBY

a year ago

I realized the error might be because I'm setting my own port, so I'm gonna change that first and check again.


a year ago


jp-cc-projects
HOBBY

a year ago

My issue did turn out to be exposing ports in the Dockerfile. Thanks for the responses.


jp-cc-projects

My issue did turn out to be exposing ports in the Dockerfile. Thanks for the responses.

rushiljalal
TRIAL

10 months ago

Could you please elaborate? I thought declaring EXPOSE 3000 is required for the docker image to build and run.


10 months ago

EXPOSE is not required, nor does Railway even use the value defined by that keyword.


Status changed to Solved brody 10 months ago


Error: Cache mount ID is not prefixed with cache key - Railway Help Station