package registry
import "github.com/docker/distribution/registry"
Package registry provides the main entrypoints for running a registry.
Index ¶
Variables ¶
var GCCmd = &cobra.Command{ Use: "garbage-collect <config>", Short: "`garbage-collect` deletes layers not referenced by any manifests", Long: "`garbage-collect` deletes layers not referenced by any manifests", Run: func(cmd *cobra.Command, args []string) { config, err := resolveConfiguration(args) if err != nil { fmt.Fprintf(os.Stderr, "configuration error: %v\n", err) cmd.Usage() os.Exit(1) } driver, err := factory.Create(config.Storage.Type(), config.Storage.Parameters()) if err != nil { fmt.Fprintf(os.Stderr, "failed to construct %s driver: %v", config.Storage.Type(), err) os.Exit(1) } ctx := dcontext.Background() ctx, err = configureLogging(ctx, config) if err != nil { fmt.Fprintf(os.Stderr, "unable to configure logging with config: %s", err) os.Exit(1) } k, err := libtrust.GenerateECP256PrivateKey() if err != nil { fmt.Fprint(os.Stderr, err) os.Exit(1) } registry, err := storage.NewRegistry(ctx, driver, storage.Schema1SigningKey(k)) if err != nil { fmt.Fprintf(os.Stderr, "failed to construct registry: %v", err) os.Exit(1) } err = storage.MarkAndSweep(ctx, driver, registry, storage.GCOpts{ DryRun: dryRun, RemoveUntagged: removeUntagged, }) if err != nil { fmt.Fprintf(os.Stderr, "failed to garbage collect: %v", err) os.Exit(1) } }, }
GCCmd is the cobra command that corresponds to the garbage-collect subcommand
var RootCmd = &cobra.Command{ Use: "registry", Short: "`registry`", Long: "`registry`", Run: func(cmd *cobra.Command, args []string) { if showVersion { version.PrintVersion() return } cmd.Usage() }, }
RootCmd is the main command for the 'registry' binary.
var ServeCmd = &cobra.Command{ Use: "serve <config>", Short: "`serve` stores and distributes Docker images", Long: "`serve` stores and distributes Docker images.", Run: func(cmd *cobra.Command, args []string) { ctx := dcontext.WithVersion(dcontext.Background(), version.Version) config, err := resolveConfiguration(args) if err != nil { fmt.Fprintf(os.Stderr, "configuration error: %v\n", err) cmd.Usage() os.Exit(1) } if config.HTTP.Debug.Addr != "" { go func(addr string) { log.Infof("debug server listening %v", addr) if err := http.ListenAndServe(addr, nil); err != nil { log.Fatalf("error listening on debug interface: %v", err) } }(config.HTTP.Debug.Addr) } registry, err := NewRegistry(ctx, config) if err != nil { log.Fatalln(err) } if config.HTTP.Debug.Prometheus.Enabled { path := config.HTTP.Debug.Prometheus.Path if path == "" { path = "/metrics" } log.Info("providing prometheus metrics on ", path) http.Handle(path, metrics.Handler()) } if err = registry.ListenAndServe(); err != nil { log.Fatalln(err) } }, }
ServeCmd is a cobra command for running the registry.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
A Registry represents a complete instance of the registry. TODO(aaronl): It might make sense for Registry to become an interface.
func NewRegistry ¶
func NewRegistry(ctx context.Context, config *configuration.Configuration) (*Registry, error)
NewRegistry creates a new registry from a context and configuration struct.
func (*Registry) ListenAndServe ¶
ListenAndServe runs the registry's HTTP server.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
registry/api | |
registry/api/errcode | |
registry/api/v2 | Package v2 describes routes, urls and the error codes used in the Docker Registry JSON HTTP API V2. |
registry/auth | Package auth defines a standard interface for request access controllers. |
registry/auth/htpasswd | Package htpasswd provides a simple authentication scheme that checks for the user credential hash in an htpasswd formatted file in a configuration-determined location. |
registry/auth/silly | Package silly provides a simple authentication scheme that checks for the existence of an Authorization header and issues access if is present and non-empty. |
registry/auth/token | |
registry/client | |
registry/client/auth | |
registry/client/auth/challenge | |
registry/client/transport | |
registry/handlers | |
registry/listener | |
registry/middleware | |
registry/middleware/registry | |
registry/middleware/repository | |
registry/proxy | |
registry/proxy/scheduler | |
registry/storage | Package storage contains storage services for use in the registry application. |
registry/storage/cache | Package cache provides facilities to speed up access to the storage backend. |
registry/storage/cache/cachecheck | |
registry/storage/cache/memory | |
registry/storage/cache/redis | |
registry/storage/driver | |
registry/storage/driver/azure | Package azure provides a storagedriver.StorageDriver implementation to store blobs in Microsoft Azure Blob Storage Service. |
registry/storage/driver/base | Package base provides a base implementation of the storage driver that can be used to implement common checks. |
registry/storage/driver/factory | |
registry/storage/driver/filesystem | |
registry/storage/driver/gcs | Package gcs implements the Google Cloud Storage driver backend. |
registry/storage/driver/inmemory | |
registry/storage/driver/middleware | |
registry/storage/driver/middleware/cloudfront | Package middleware - cloudfront wrapper for storage libs N.B. currently only works with S3, not arbitrary sites |
registry/storage/driver/middleware/redirect | |
registry/storage/driver/oss | Package oss implements the Aliyun OSS Storage driver backend. |
registry/storage/driver/s3-aws | Package s3 provides a storagedriver.StorageDriver implementation to store blobs in Amazon S3 cloud storage. |
registry/storage/driver/swift | Package swift provides a storagedriver.StorageDriver implementation to store blobs in Openstack Swift object storage. |
registry/storage/driver/testdriver | |
registry/storage/driver/testsuites |
- Version
- v2.8.3+incompatible (latest)
- Published
- Oct 2, 2023
- Platform
- linux/amd64
- Imports
- 30 packages
- Last checked
- 1 day ago –
Tools for package owners.