Skip to content

Instantly share code, notes, and snippets.

@armand1m
Last active February 29, 2020 01:41
Show Gist options
  • Save armand1m/e0fc2c28ee8f6f4021a9bfb71fd661d7 to your computer and use it in GitHub Desktop.
Save armand1m/e0fc2c28ee8f6f4021a9bfb71fd661d7 to your computer and use it in GitHub Desktop.
Search through docker hub community in a single line bash function
search_dockerhub() {
curl -s "https://hub.docker.com/api/content/v1/products/search?source=community&q=$1&page=1&page_size=10" | jq -r '.summaries[]["name"]'
}
@armand1m
Copy link
Author

armand1m commented Feb 29, 2020

Requirements:

  • jq: JSON CLI processor

Usage:

  • Put this function in your ~/.bashrc or ~/.zshrc
  • Create a new shell session or source ~/.bashrc
  • Profit:
$ search_dockerhub kube-apiserver
empiregeneral/kube-apiserver-amd64
kubeimage/kube-apiserver-amd64
mirrorgooglecontainers/kube-apiserver
mirrorgooglecontainers/kube-apiserver-amd64
aiotceo/kube-apiserver
pigletfly/kube-apiserver-amd64
zhaowenlei/kube-apiserver
graytshirt/kube-apiserver
kubeimage/kube-apiserver
kontenapharos/kube-apiserver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment