5

I am new to Docker, but I am confused about how the docker images ls -a behaves differently in Docker desktop. Unlike when running in linux it does not show intermediate/dangling images, but it only lists the images I tag explictly.

To illustrate the issue, say I have this Dockerfile.

FROM python:3
RUN apt update
RUN apt install -y vim

Save it as Dockerfile and build and tag the image via the command docker build -t pyvim .

When I execute the command docker images -a on Linux machines I get

REPOSITORY   TAG       IMAGE ID       CREATED          SIZE
pyvim        latest    9d3e171e0220   13 minutes ago   938MB
<none>       <none>    360f898a1298   13 minutes ago   904MB
python       3         cba42c28d9b8   2 days ago       886MB

which is what I expect, the Python 3 image, my image, and the dangling image in the middle resulting from running apt update.

However, after following the same steps on Mac or Windows, both running 'Docker desktop', docker images -a only shows the 'pyvim' image:

REPOSITORY   TAG       IMAGE ID       CREATED          SIZE
pyvim        latest    63926d5470fe   18 minutes ago   938MB

I don't understand this behaviour. It looks like the -a flag has no effect on windows/mac.

  • It appears this behaviour has something to do with buildkit, enabled by default on Docker desktop. With buildkit is disabled the behaviour is the same regardless of the host OS – Manuel Pagliai Jul 30 '21 at 15:24

0 Answers0