To search a image on docker remote registry you can use docker search command.
email@example.com:~# docker search ubuntu NAME DESCRIPTION STARS OFFICIAL AUTOMATED ubuntu Ubuntu is a Debian-based Linux operating s... 4482 [OK] ubuntu-upstart Upstart is an event-based replacement for ... 65 [OK] rastasheep/ubuntu-sshd Dockerized SSH service, built on top of of... 32 [OK] torusware/speedus-ubuntu Always updated official Ubuntu docker imag... 27 [OK]
This example displays images with a name containing
ubuntu. First column displays the name of image. You may notice
rastasheep/ubuntu-sshd has a
/ in the name. The left portion i.e.
rastasheep is the username and right portion i.e.
ubuntu-sshd is the image name. Some image does not have a
/ in the name, just like the first one i.e.
ubuntu. In this case
library is the username
Note: Search queries will only return up to 25 results. You can use --limit option to change the search result display limit.
docker pull is the command to pull docker image from remote registry.
firstname.lastname@example.org:~# docker pull debian Using default tag: latest latest: Pulling from library/debian
This will try to pull the image with latest tag.
List first 10 tags
Listing all the available tag can be tricky. Well that information is always available on the image info page on hub.docker.com. There are lot of cases that you may need this information using a command line. This can be done using a simple API call and parsing the
json output using
email@example.com:~# curl 'https://registry.hub.docker.com/v2/repositories/library/debian/tags/'|jq '."results"["name"]' "7.11" "testing" "oldstable-backports" "oldstable" "8" "8.5" "stretch" "experimental" "rc-buggy" "wheezy-backports"
jqis a tool for processing JSON inputs.
sedfor JSON data - you can use it to slice and filter and map and transform structured data with the same ease that
grepand friends let you play with text.
A script to List all Tags
i=0 while [ $? == 0 ] do i=$((i+1)) curl https://registry.hub.docker.com/v2/repositories/library/debian/tags/?page=$i 2>/dev/null|jq '."results"["name"]' done
and now debian image with a specific tag can be pulled using
firstname.lastname@example.org:~# docker pull debian:testing
Or if you want to pull all tag of a image
email@example.com:~# docker pull -a debian
Like it? Click here to Tweet your feedback