Docker自己構築倉庫自己開発管理


Dockerは自分で倉庫を建ててから鏡像を管理する問題に直面しています.ここで簡単な手順を書いて、レンガを投げて玉を引くとしています.
  • pom.xmlの導入が必要なフレームバックは、jfinalにはパッケージされたhttp処理関数がありますので、簡単です.jfinalパッケージが必要です.jsonパッケージは解析帰りのjson結果
  • <dependency>
  •     <groupId>com.jfinalgroupId>
  •     <artifactId>jfinalartifactId>
  •     <version>2.2version>
  •    dependency>
  •    <dependency>

  •     <groupId>com.hynnetgroupId>
  •     <artifactId>json-libartifactId>
  •     <version>2.4version>
  •    dependency>


    1. import com.jfinal.kit.HttpKit;

    2. import net.sf.json.JSONArray;

    3. import net.sf.json.JSONObject;
    4. public class Main {

    5.    // get url , URL
    6. public static String httget(String url) {
    7. String s = HttpKit.get(url);

    8. return s;

    9. }
    10. public static void main(String[] args) {
    11. // http://10.100.112.243:5000 , V2
    12. String baseUrl = "http://10.100.112.243:5000/v2/";
    13. String catalog = baseUrl + "_catalog";

    14.      
    15.    //

    16.       JSONObject obj = JSONObject.fromObject(httget(catalog));
    17.        // json , json ,

    18. JSONArray obj_minions = obj.getJSONArray("repositories");
    19.        //

    20. for (int i = 0; i < obj_minions.size(); i++) {
    21. System.out.println( httget(baseUrl + "/" + obj_minions.get(i) + "/tags/list"));

    22. }
    23. }
    24. }

      1. {"name":"apsops/filebeat-kubernetes","tags":["v0.2"]}

      2. {"name":"bobrik/curator","tags":["latest"]}

      3. {"name":"busybox","tags":["latest"]}



      4. , CURD “C” 。

        , , , 。



        ( 1)

        method path Entity Description
        GET /v2/ Base Check that the endpoint implements Docker Registry API V2.
        GET /v2//tags/list Tags Fetch the tags under the repository identified by name.
        GET /v2//manifests/ Manifest Fetch the manifest identified by nameand referencewhere referencecan be a tag or digest. A HEADrequest can also be issued to this endpoint to obtain resource information without receiving all data.
        PUT /v2//manifests/ Manifest Put the manifest identified by nameand referencewhere referencecan be a tag or digest.
        DELETE /v2//manifests/ Manifest Delete the manifest identified by nameand reference. Note that a manifest can only be deleted by digest.
        GET /v2//blobs/ Blob Retrieve the blob from the registry identified bydigest. A HEADrequest can also be issued to this endpoint to obtain resource information without receiving all data.
        DELETE /v2//blobs/ Blob Delete the blob identified by nameand digest
        POST /v2//blobs/uploads/ Initiate Blob Upload Initiate a resumable blob upload. If successful, an upload location will be provided to complete the upload. Optionally, if thedigest parameter is present, the request body will be used to complete the upload in a single request.
        GET /v2//blobs/uploads/ Blob Upload Retrieve status of upload identified byuuid. The primary purpose of this endpoint is to resolve the current status of a resumable upload.
        PATCH /v2//blobs/uploads/ Blob Upload Upload a chunk of data for the specified upload.
        PUT /v2//blobs/uploads/ Blob Upload Complete the upload specified by uuid, optionally appending the body as the final chunk.
        DELETE /v2//blobs/uploads/ Blob Upload Cancel outstanding upload processes, releasing associated resources. If this is not called, the unfinished uploads will eventually timeout.
        GET /v2/_catalog Catalog Retrieve a sorted, json list of repositories available in the registry.


        1  http://blog.csdn.net/ztsinghua/article/details/51496658