diff --git a/main.go b/main.go index 77aa68f3..54372ddb 100644 --- a/main.go +++ b/main.go @@ -46,7 +46,7 @@ func preload(c *cli.Context) (err error) { } // create the registry client - r, err = registry.New(auth, c.GlobalBool("debug")) + r, err = registry.New(auth, c.GlobalBool("debug"), c.GlobalBool("skipverify")) if err != nil { return err } @@ -69,6 +69,10 @@ func main() { Name: "debug, d", Usage: "run in debug mode", }, + cli.BoolFlag{ + Name: "skipverify, k", + Usage: "do not verify tls certificates", + }, cli.StringFlag{ Name: "username, u", Usage: "username for the registry", diff --git a/registry/registry.go b/registry/registry.go index ad43e93a..1d93e600 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -33,8 +33,11 @@ func Log(format string, args ...interface{}) { } // New creates a new Registry struct with the given URL and credentials. -func New(auth types.AuthConfig, debug bool) (*Registry, error) { - transport := http.DefaultTransport +func New(auth types.AuthConfig, debug bool, skipverify bool) (*Registry, error) { + transport := http.DefaultTransport.(*http.Transport) + transport.TLSClientConfig = &tls.Config{ + InsecureSkipVerify: skipverify, + } return newFromTransport(auth, transport, debug) }