mirror of
https://github.com/genuinetools/reg.git
synced 2024-09-28 11:46:20 -04:00
Merge branch 'pr-93'
* pr-93: Add option to fetch Docker-Content-Digest Fix typo
This commit is contained in:
commit
9534afc84a
4 changed files with 50 additions and 2 deletions
10
README.md
10
README.md
|
@ -11,6 +11,7 @@ Docker registry v2 command line client.
|
||||||
+ [Auth](#auth)
|
+ [Auth](#auth)
|
||||||
+ [List Repositories and Tags](#list-repositories-and-tags)
|
+ [List Repositories and Tags](#list-repositories-and-tags)
|
||||||
+ [Get a Manifest](#get-a-manifest)
|
+ [Get a Manifest](#get-a-manifest)
|
||||||
|
+ [Get the Digest](#get-the-digest)
|
||||||
+ [Download a Layer](#download-a-layer)
|
+ [Download a Layer](#download-a-layer)
|
||||||
+ [Delete an Image](#delete-an-image)
|
+ [Delete an Image](#delete-an-image)
|
||||||
+ [Vulnerability Reports](#vulnerability-reports)
|
+ [Vulnerability Reports](#vulnerability-reports)
|
||||||
|
@ -49,6 +50,7 @@ AUTHOR:
|
||||||
|
|
||||||
COMMANDS:
|
COMMANDS:
|
||||||
delete, rm delete a specific reference of a repository
|
delete, rm delete a specific reference of a repository
|
||||||
|
digest get the digest
|
||||||
layer, download download a layer for the specific reference of a repository
|
layer, download download a layer for the specific reference of a repository
|
||||||
list, ls list all repositories
|
list, ls list all repositories
|
||||||
manifest get the json manifest for the specific reference of a repository
|
manifest get the json manifest for the specific reference of a repository
|
||||||
|
@ -105,7 +107,7 @@ latest
|
||||||
stable
|
stable
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get a Manifest
|
## Get a Manifest
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ reg manifest htop
|
$ reg manifest htop
|
||||||
|
@ -126,6 +128,12 @@ $ reg manifest htop
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Get the Digest
|
||||||
|
```console
|
||||||
|
$ reg digest htop
|
||||||
|
sha256:791158756cc0f5b27ef8c5c546284568fc9b7f4cf1429fb736aff3ee2d2e340f
|
||||||
|
```
|
||||||
|
|
||||||
### Download a Layer
|
### Download a Layer
|
||||||
|
|
||||||
```console
|
```console
|
||||||
|
|
39
digest.go
Normal file
39
digest.go
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/genuinetools/reg/repoutils"
|
||||||
|
"github.com/urfave/cli"
|
||||||
|
)
|
||||||
|
|
||||||
|
var digestCommand = cli.Command{
|
||||||
|
Name: "digest",
|
||||||
|
Usage: "get the Docker-Content-Digest",
|
||||||
|
Action: func(c *cli.Context) error {
|
||||||
|
if len(c.Args()) < 1 {
|
||||||
|
return fmt.Errorf("pass the name of the repository")
|
||||||
|
}
|
||||||
|
|
||||||
|
repo, ref, err := repoutils.GetRepoAndRef(c.Args()[0])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var digest interface{}
|
||||||
|
digest, err = r.Digest(repo, ref)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
b, err := json.MarshalIndent(digest, " ", " ")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(string(b))
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
1
main.go
1
main.go
|
@ -67,6 +67,7 @@ func main() {
|
||||||
|
|
||||||
app.Commands = []cli.Command{
|
app.Commands = []cli.Command{
|
||||||
deleteCommand,
|
deleteCommand,
|
||||||
|
digestCommand,
|
||||||
layerCommand,
|
layerCommand,
|
||||||
listCommand,
|
listCommand,
|
||||||
manifestCommand,
|
manifestCommand,
|
||||||
|
|
|
@ -14,7 +14,7 @@ var manifestCommand = cli.Command{
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "v1",
|
Name: "v1",
|
||||||
Usage: "force the version of the manifest retreived to v1",
|
Usage: "force the version of the manifest retrieved to v1",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
|
|
Loading…
Reference in a new issue