-
So I'm working on a build stage in container for my app. When buildah runs Below is a fragment of Dockerfile with build stage: FROM rust:1.80.0-alpine3.20 as builder
RUN mkdir /app
WORKDIR /app
VOLUME [ "/app" ]
COPY . /app
# RUN apk install --no-cache libcurl-dev
# RUN --mount=type=cache,target=/app/target cargo install --path .
RUN cargo build -v -r && cp target/release/app ./app
RUN ls -l Podman: podman-5.1.2-1.fc40 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The contents of the volume (/app) are "frozen" once it's declared with the VOLUME instruction, in that they're only modified by ADD and COPY instructions, so changes made to their contents during RUN instructions are being reverted when the instruction completes. This is an older |
Beta Was this translation helpful? Give feedback.
The contents of the volume (/app) are "frozen" once it's declared with the VOLUME instruction, in that they're only modified by ADD and COPY instructions, so changes made to their contents during RUN instructions are being reverted when the instruction completes. This is an older
docker build
behavior that we mimic and that newer versions ofdocker build
stopped doing.You can either move the VOLUME instruction to the end of the file so that changes made during RUN instructions won't be discarded when they're made, drop the VOLUME instruction entirely, or update to 5.2, where that behavior will both no longer be the default, and will be selectable with a --compat-volumes flag.