docker image can't delete the solution

  • 2020-06-01 11:27:06
  • OfStack

When using Docker, image cannot be deleted, as follows:

root@ubuntu:/opt/docker# docker images
door/ubuntu-nginx  v2         5e4f2da203e2    5 minutes ago    283.3 MB
<none>       <none>       46987ed2da40    33 minutes ago   129 MB
<none>       <none>       20248c31e1a2    45 minutes ago   129 MB
door/ubuntu-nginx  v1         0e35a55569f5    About an hour ago  280.8 MB
ubuntu       latest       104bec311bcd    2 weeks ago     129 MB
hello-world     latest       c54a2cc56cbb    6 months ago    1.848 kB
root@ubuntu:/opt/docker# docker rmi 5e4f2da203e2
Error response from daemon: conflict: unable to delete 5e4f2da203e2 (must be forced) - image is being used by stopped container 06622513ce3c


1. Check the records first docker ps -a

2. Delete all records of the image. If you delete all records of the image, you can use :docker ps-a |awk '{print $1}'|xargs docker rm

3. docker rmi 5e4f2da203e2 It is ok

There are still net friends using service docker restrat and then delete, I tried 1 did not work, may be because the environment is not 1, ha ha!

Related articles: