Docker Getting Started Tutorial (vii) Docker API

Source: Internet
Author: User
Tags oauth docker hub docker registry

Docker Introductory Tutorial (vii) Docker API "Editor's note" dockerone organization translated FLUX7 's Docker starter tutorial, this is the seventh in a series of introductory tutorials focusing on the Docker Registry API and the Docker Hub API.

Throughout our series of Docker tutorials, we have discussed a number of important Docker components and commands. In this article, we'll continue in-depth study of Docker: Dissecting Docker APIs.

Docker provides a lot of APIs for users to use. These APIs include four aspects:
    • Docker Registry API
    • Docker Hub API
    • Docker OAuth API
    • Docker Remote API

Specifically to this article, we will discuss the Docker Registry API and the Docker Hub API.

The Docker Registry Apidocker Registry API is the rest API for Docker Registry, which simplifies the storage of mirrors and warehouses. The API does not have access to user accounts or authorization. You can read the fourth chapter of the Docker series to learn more about the types of registry (the Translator notes: There are several different registry in Docker).

Extract image layer: Take out mirror layers:
GET /v1/images/(image_id)/layer


Insert Image layer: Inserts the mirrored layers:
PUT /v1/images/(image_id)/layer

Retrieve an Image: Retrieving the Image:
GET /v1/images/(image_id)/json

Retrieve roots of an image: Retrieving the root image:
GET /v1/images/(image_id)/ancestry

Obtain all tags or specific tag of a repository: get all the tags in the library or specify tags:
GET /v1/repositories/(namespace)/(repository)/tags

Or
GET /v1/repositories/(namespace)/(repository)/tags/(tag*)

Delete a tag: Remove tag:
DELETE /v1/repositories/(namespace)/(repository)/tags/(tag*)

Status check of Registry:registry state checks:
GET /v1/_ping

The Docker hub Apidocker Hub API is a simple rest API for the Docker hub. To remind you, refer to the fourth article in the Docker Series tutorial for Docker Hub. Docker Hub controls user accounts and authorizations through administrative checksums (checksums) and public namespaces. The API also supports operations on user warehouses and library warehouses.

First, let's take a look at the Special Library repository (requires Administrator privileges) command:
1. Create a new warehouse. Use the following command to create a new library repository:
PUT /v1/repositories/(repo_name)/
which repo_nameis the new warehouse name.
2. Delete the warehouse that already exists. The command is as follows:
DELETE /v1/repositories/(repo_name)/
which repo_nameis the name of the warehouse to be deleted.
3. Update the warehouse image. The command is as follows:
PUT /v1/repositories/(repo_name)/images
4. Get the image from the warehouse. The command is as follows:
GET /v1/repositories/(repo_name)/images
5. Authorization. Use token to obtain a warehouse authorization as follows:
PUT /v1/repositories/(repo_name)/auth
Next, let's take a look at the commands of the user repository. The main difference between a library warehouse and a user's Warehouse command is the use of namespaces.

1. Create a user repository. The command is as follows:
PUT /v1/repositories/(namespace)/(repo_name)/

2. Delete the user repository with the following command:
DELETE /v1/repositories/(namespace)/(repo_name)/

3. Update the user's warehouse image with the following command:
PUT /v1/repositories/(namespace)/(repo_name)/images

4. Download the image from the warehouse. As follows:
GET /v1/repositories/(namespace)/(repo_name)/images

5. Verify that the user is logged in as follows:
GET /v1/users

6. Add a new user with the following command:
POST /v1/users
7. Update the user information as follows:
PUT /v1/users/(username)/

Now that we've gone through the first leg of the Docker API tour, the second stop is about Docker OAuth and the remote API, which we'll see in the next section of the Docker series tutorial.

Original link: Ultimate Guide for Docker APIs (translator: Tian Vast review: Li Yingjie)

Docker Getting Started Tutorial (vii) Docker API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.