Is it possible to hide layers from base image?
mgzenitech opened this issue · 1 comments
mgzenitech commented
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/
IMAGE 2:
### [ INTERNAL ] #$$$$$$$$$$$$$$$$##############################################
ARG REGISTRY
ARG VERSION
### [ CONFIGURATION ] #$$$$$$$$$$$$$$$$#########################################
ARG VERSION_PYENV=$VERSION
ARG VERSION_BASE=3.17.3
### [ TEMP ] #$$$$$$$###########################################################
### [ BUILD ] #$$$$$$$$$$$$$####################################################
FROM $REGISTRY/internal/base:v$VERSION_BASE
When opening with dive IMAGE 2 I see layers also from the first one, which is unwanted:
7.0 MB FROM f1417ff83b319fb
38 B echo 'set -e -o pipefail' | tee -a /root/.bashrc /root/.bash_profile
1.2 kB sed -i 's#root:x:0:0:root:/root:/bin/ash#root:x:0:0:root:/root:/bin/bash#g' /etc/passwd
388 B #(nop) COPY dir:3b19c1ae653351cddacb67b5097a9a657cb129a3b4d5459fe9c138917c606890 in /etc/bash
789 kB #(nop) COPY file:d9a538d67076e2417fc311146e28c837c7fbff10186eb730853a9067ef893296 in /bin/bash
530 kB #(nop) COPY dir:36b87930e373538af151a625768da08bbaab550a3788ad8fe2eb2679a56b7cc9 in /usr/lib/bash
1.6 MB #(nop) COPY multi:cd3f0e79402a56302309a0dcdd9b4db2b8e295891332bcc2514d36ec4fc3a355 in /usr/lib/
118 kB #(nop) COPY multi:1fd305f6d1b6188ad1e4711cd39ab74b0d13b811d5903cc509c97fd437b9df7b in /lib/
0 B #(nop) COPY dir:4366df1f3fa53761d426231eec4f91fc4ea6c5269036e5741dd3baa28fb871a9 in /lib64
28 kB #(nop) COPY multi:75713c8d5c5678a055b803156a00b889e55c013bc63fede4a99ba8103721e3b2 in /usr/lib/
How can I hide base image layers?
daveisfera commented
Won't hiding Unmodified files by pressing ^U
do this?