Skip to content

Docker Registry v2 API

The Docker Registry v2 API is the HTTP interface used by Docker clients and tools to interact with a Registry server (specifically version 2)^[600-developer__docker__Dockerfile__Dockerfile-01.md]. It facilitates operations such as pushing images, pulling images, and querying registry metadata^[600-developer__docker__Dockerfile__Dockerfile-01.md]。

Core Endpoints

The API follows a structure that typically begins with /v2/.

Catalog

To list all available image repositories in the registry, the /v2/_catalog endpoint is used^[600-developer__docker__Dockerfile__Dockerfile-01.md]。This returns a JSON object containing a list of repository names^[600-developer__docker__Dockerfile__Dockerfile-01.md]。

curl -X GET http://127.0.0.1:5000/v2/_catalog

Response Example:

{"repositories":["mytomcat"]}

Tags List

To retrieve the tags available for a specific image repository, the API path follows the pattern /v2/<image_name>/tags/list^[600-developer__docker__Dockerfile__Dockerfile-01.md]。

curl -X GET http://127.0.0.1:5000/v2/mytomcat/tags/list

Response Example:

{"name":"mytomcat","tags":["latest"]}

Client Operations

While the API provides low-level access, standard Docker commands abstract these calls to manage images^[600-developer__docker__Dockerfile__Dockerfile-01.md]。

  • Pulling Images: Downloading an image from the registry.
    docker pull 127.0.0.1:5000/mytomcat
    
  • Pushing Images: Uploading a local image to the registry. This requires tagging the local image with the registry's address first^[600-developer__docker__Dockerfile__Dockerfile-01.md]。
    docker tag mytomcat 127.0.0.1:5000/mytomcat
    docker push 127.0.0.1:5000/mytomcat
    

Implementation

The standard implementation of this API is the open-source Distribution registry, commonly referenced as registry:2 in Docker ecosystems^[600-developer__docker__Dockerfile__Dockerfile-01.md]。This server handles the storage and retrieval of image layers and manifests.

Sources

^[600-developer__docker__Dockerfile__Dockerfile-01.md]