Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Allow to untag images associated with running or paused containe…
…rs by nerdctl rmi -f In Docker, running `docker rmi -f <Image Names>` on images associated with running or stopped containers will untag the images, leaving <none> images. The specific behavior in Docker is as follows. ``` > docker images REPOSITORY TAG IMAGE ID CREATED SIZE alpine latest 91ef0af61f39 6 weeks ago 7.8MB > docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES fe4caab5cf42 alpine "sleep infinity" 4 minutes ago Up 4 minutes test > docker rmi -f alpine Untagged: alpine:latest Untagged: alpine@sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d > docker images REPOSITORY TAG IMAGE ID CREATED SIZE <none> <none> 91ef0af61f39 6 weeks ago 7.8MB ``` On the other hand, the same operation described above with nerdctl will result in the following error. ``` > nerdctl rmi -f alpine FATA[0000] 1 errors: conflict: unable to delete alpine (cannot be forced) - image is being used by running container 59261bebc8113ca1ea102203137c32406742c2ec43ca3b108a314e9bfb4657fb ``` This befavior is reported in the following: - #3454 Therefore, this commit fixes it so that `nerdctl rmi -f <Image Names>` can be performed on images associated with running or stopped containers. The behaviour in nerdctl after this modification is as follows. ``` > nerdctl images REPOSITORY TAG IMAGE ID CREATED PLATFORM SIZE BLOB SIZE alpine latest beefdbd8a1da 5 seconds ago linux/amd64 8.458MB 3.626MB > nerdctl ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 28c9db821576 docker.io/library/alpine:latest "sleep infinity" 6 seconds ago Up alpine-28c9d > nerdctl rmi -f alpine Untagged: docker.io/library/alpine:latest Untagged: sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d > nerdctl images REPOSITORY TAG IMAGE ID CREATED PLATFORM SIZE BLOB SIZE <none> <none> beefdbd8a1da 3 seconds ago linux/amd64 8.458MB 3.626MB ``` Signed-off-by: Hayato Kiwata <[email protected]>
- Loading branch information