Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Docker interactive image deletion
#!/bin/bash
select x in `docker images --format '{{.ID}}--{{.Repository}}/{{.Tag}}'` ; do docker rmi "${x%--*}"; done
@pzelnip

This comment has been minimized.

Copy link
Owner Author

commented Jun 8, 2018

Allows you to interactively in a shell delete local Docker images.

Running it:

$ docker_image_delete.sh
 1) 18bfe820e13a--microsoft/dotnet/1.1-sdk
 2) 452a96d81c30--ubuntu/latest
 3) c9d990395902--ubuntu/16.04
 4) 2dea9e73d89e--nginx/1.13.11-alpine
 5) 9cc35bb87070--ruby/2.3
#? 1
Untagged: microsoft/dotnet/1.1-sdk
Deleted: sha256:17993168784ac66b1274d8f60b5d0b0f90512bd1e733dd8092294d9a6dd49ab3
Deleted: sha256:e59553776430ec15c5b927c682214351db83fd757c807b4915edbac1120aa983
....
#? 3
Untagged: ubuntu/16.04
Deleted: sha256:17993168784ac66b1274d8f60b5d0b0f90512bd1e733dd8092294d9a6dd49ab3
Deleted: sha256:e59553776430ec15c5b927c682214351db83fd757c807b4915edbac1120aa983
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.