How to print only image ID in 'docker image ls' Use --format '{{.ID}}': docker image ls --format '{{.ID}}'