-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (37 loc) · 1.01 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const drc = require('docker-registry-client');
var rat = drc.parseRepoAndTag("python:3.6");
console.log(JSON.stringify(rat, null, 4));
var client = drc.createClientV2({
repo: rat,
});
client.getManifest({ref: rat.tag }, function(err, manifest, res, manifestStr) {
if(err) { console.error(err); return; }
console.log("response headers: ");
console.log(JSON.stringify(res.headers, null, 4));
console.log("\nmanifestStr: ");
console.log(manifestStr);
console.log("\nmanifest: ");
console.log(JSON.stringify(manifest, null, 4));
if(manifest.history) {
console.log("History: ");
manifest.history.forEach(h=>{
if(h.v1Compatibility) {
var desc = JSON.parse(h.v1Compatibility);
console.log(JSON.stringify(desc, null, 4));
} else {
console.log("Unknown history obj");
}
});
}
if(manifest.fsLayers) {
console.log("Layers:");
manifest.fsLayers.forEach(l=>{
if(l.blobSum) {
console.log(l.blobSum);
} else {
console.log("Unknown layer");
}
});
}
client.close();
});