For historical reasons, the local image store still has code in place to disallow removing "parent" images.
For example;
$ DOCKER_BUILDKIT=0 docker build -t parent -<<EOF
FROM scratch
LABEL foo=bar
EOF
$ DOCKER_BUILDKIT=0 docker build -t child -<<EOF
FROM parent:latest
LABEL foo=baz
EOF
$ docker images ls --filter reference=parent
REPOSITORY TAG IMAGE ID CREATED SIZE
parent latest 17789f62da6c About an hour ago 0 B
$ docker image rm 17789f62da6c
Error response from daemon: conflict: unable to delete 17789f62da6c (cannot be forced) - image has dependent child images
Since the introduction of the content-addressable store, the "child/parent" chain
is only used for the local build cache, but is not required to run an image.
I think we should allow removing the parent image if --force is used.
Note that removing the parent image will not cleanup any disk space (because
the layers are still used by the child image), however it does allow users
to clean up images they no longer need.
related discussion #25602
/cc @tonistiigi @dmcgowan
For historical reasons, the local image store still has code in place to disallow removing "parent" images.
For example;
Since the introduction of the content-addressable store, the "child/parent" chain
is only used for the local build cache, but is not required to run an image.
I think we should allow removing the parent image if
--forceis used.Note that removing the parent image will not cleanup any disk space (because
the layers are still used by the child image), however it does allow users
to clean up images they no longer need.
related discussion #25602
/cc @tonistiigi @dmcgowan