What is the difference between docker images and docker search commands?

时间:2016-04-25 09:21:08

标签: docker coreos

On a coreOS (899.15.0) machine, when I execute docker search and images I get the following results :

docker search private-registry:5000/

NAME      DESCRIPTION   STARS     OFFICIAL   AUTOMATED

docker images on the private registry machine:

REPOSITORY                                                      TAG                 IMAGE ID                                                           CREATED             VIRTUAL SIZE
nginx                                                           latest              e32087da8ee6dfa45221c48670fa9475f3d8a53a0e9ccabef4f741c62c77d49b   2 weeks ago         182.6 MB
registry                                                        0.9.1               facc02b3acf6f811e8eace6d07b34cd5ab687e926ac5b5231da93264b259f1a4   12 weeks ago        422.8 MB
<none>                                                          <none>              db81ebdc7ebd3d7aec05d4faa6f4c9c2e35954896e968bce2f90a9736485aa06   3 months ago        422.8 MB

...and a few more images

The reference for docker search mentions that it looks up on docker hub, but since I am specifying a specific registry here, I suppose it is looking up in the private repository.

I am not sure what is the difference between these two commands here and why the difference in results.

1 个答案:

答案 0 :(得分:1)

You are supposing wrongly. docker search searches only Docker Hub, not private registries. docker images command lists images on the machine (locally built or pulled from registries).

If you want to search or list images in the private registry, you need to use registry API to do so: https://docs.docker.com/registry/spec/api/