Build Dockerfile none

Hello,

When I build I have several images in None!

REPOSITORY       TAG           IMAGE ID       CREATED         SIZE
MyIMG   v5       c91d47429ad5  4 minutes ago   891MB
<none>           <none>        facad6069d18   5 minutes ago   738MB
<none>           <none>        8b37cf276986   5 minutes ago   738MB
<none>           <none>        89df7a21b848   5 minutes ago   737MB
<none>           <none>        c990a5986ec8   5 minutes ago   731MB
<none>           <none>        3123e8bdfa8d   5 minutes ago   731MB
<none>           <none>        884d38a0178c   9 minutes ago   69.3MB
<none>           <none>        8596303532d3   9 minutes ago   69.3MB
debian           buster        206294455d54   4 weeks ago     69.3MB

Is this normal and is it possible to improve my Dockerfile?

Thank’s

My Dockerfile :

FROM debian:buster

ENV NO="v16.14.0" \
    VIV=16.4.3

RUN apt-get update && apt-get install -y \
    build-essential \
    iputils-ping \
    && rm -rf /var/lib/apt/lists/*

COPY folder1 /user/folder1
COPY folder2 /user/folder2
COPY otherfolder /user/otherfolder
COPY libfolder /user/tp/libfolder

RUN echo 'fr_FR.UTF-8 UTF-8' > /etc/locale.gen \
    && locale-gen \
    && pip install vsfsdfsd \
    && pip install pip --upgrade \
    && pip install --no-cache-dir dfdfds \
    && cd /razrer && make install \
    && cd /rofser && make install \
    && cd /rofsf && make install \
    && cd /ssfs && make install \
    && mkdir -p /dfsfs \
    && wget https://x64.tar.xz -O  x64.tar.xz \
    && tar -xJvf x64.tar.xz -C /usr/fsdfsf \
    && ln -s rrzrezerze \
    && ln -s /sffsfsf \
    && ln -s fsffsfsff

When you build an image multiple times with the same name, only your latest image will have the name. The older versions will remain there but without name. You can list them:

docker image ls --filter dangling=true

and delete them

docker image prune

The other case when you can see images like that is when you run docker image ls --all, so you can see intermediate images. They are created when you build an image with multiple layers. Those images are exist only on our machine. If you push it to a registry and other people download it, they won’t see it as images, but they will still have the layers. You can also export the image to a tar file, delete the image and load it back. The intermediate images will not be there anymore.

docker image save -o image.tar yourimagename
docker image rm yourimagename
docker image load -i image.tar

If you have built your image with --rm=false to keep the build containers created for each instruction in the Dockerfile, then you need to delete those containers before deleting the images.

So yes, it is normal. Don’t worry about it.

Thank’s for your explanation, it is very clear.