Skip to content

Instantly share code, notes, and snippets.

@detj
Created November 15, 2023 10:40
Show Gist options
  • Save detj/87c2f794de479c5bdd2a1d80d4ba1b8b to your computer and use it in GitHub Desktop.
Save detj/87c2f794de479c5bdd2a1d80d4ba1b8b to your computer and use it in GitHub Desktop.
get docker image ids
# grab list of image ids
docker images -a | tail -n+2 | awk '{print $3}'
# Explanation
#
# -n+2 removes the table header from the output
# awk '{print $3}' grabs the image column values
# Output
# 337e5a6d0948
# 95fc5f0c90ab
# d6b7d816fc33
# a7aeb31993ea
# b485a85d5688
# 45170e471fbe
# 4cc78c1407cb
# grab list of image ids based on a regex pattern (using ripgrep)
docker images -a | rg <pattern> | awk '{print $3}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment