I currently built two images locally and one of the refers the other via FROM instruction. When looking into this image via dive I see layers from base image.
IMAGE 1:
### [ INTERNAL ] #$$$$$$$$$$$$$$$$##############################################
ARG REGISTRY
ARG VERSION
### [ CONFIGURATION ] #$$$$$$$$$$$$$$$$#########################################
ARG VERSION_ALPINE=$VERSION
### [ TEMP ] #$$$$$$$###########################################################
FROM alpine:$VERSION_ALPINE AS bash
RUN apk add --no-cache bash
FROM alpine:$VERSION_ALPINE AS gcompat
RUN apk add --no-cache gcompat
### [ BUILD ] #$$$$$$$$$$$$$####################################################
FROM alpine:$VERSION_ALPINE
ENTRYPOINT ["/bin/bash"]
RUN echo 'set -e -o pipefail' | tee -a /root/.bashrc /root/.bash_profile
RUN sed -i 's#root:x:0:0:root:/root:/bin/ash#root:x:0:0:root:/root:/bin/bash#g' /etc/passwd
COPY --from=bash /etc/bash /etc/bash
COPY --from=bash /bin/bash /bin/bash
COPY --from=bash /usr/lib/bash /usr/lib/bash
COPY --from=bash /usr/lib/libformw.so.6* /usr/lib/libmenuw.so.6* /usr/lib/libncursesw.so.6* \
/usr/lib/libpanelw.so.6* usr/lib/libreadline.so.8* /usr/lib/
COPY --from=gcompat /lib/ld-linux-x86-64.so.2 /lib/libgcompat.so.0 /lib/libucontext.so.1 \
/lib/libucontext_posix.so.1 /lib/
COPY --from=gcompat /lib64 /lib64
COPY --from=gcompat /usr/lib/libobstack.so.1* /usr/lib/
I currently built two images locally and one of the refers the other via FROM instruction. When looking into this image via dive I see layers from base image.
IMAGE 1:
IMAGE 2:
When opening with dive IMAGE 2 I see layers also from the first one, which is unwanted:
How can I hide base image layers?