The following linux commands can be used to remove all Docker images stored in your local repository. Be aware that you would not be able to undo any of the removed docker images. First, list all your docker images to make sure that there is nothing you want to remove:
# docker images
Using the following linux command you can obtain image IDs of all your docker images:
# docker images -q
To remove a single docker image simply run docker rmi followed by the image ID. For example:
# docker rmi 9fa0e1f381ad
In order to remove all image at once with a single command we can combine two commands together:
# docker rmi `docker images -q`
The above command will not remove images which are currently being used by containers and the following error message will appear:
Error response from daemon: Conflict, cannot force delete 568f5ffe3905 
because the running container 9fa0e1f381ad is using it, stop it and retry
To remove docker images even if they are used by container use force switch:
# docker rmi -f `docker images -q`
FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in: