Docker私有注册表镜像-禁止使用

问题描述 投票:-1回答:1

我在配置注册表内部镜像时遇到问题。我总是收到禁止的错误。

当我直接访问URL https://registry-1.docker.io/v2/时,我也遇到相同的错误:

{"errors":[{"code":"UNAUTHORIZED","message":"access to the requested resource is not authorized","detail":null}]}

config.yml:

version: 0.1
log:
  fields:
    service: registry
storage:
    delete:
        enabled: true
    cache:
        blobdescriptor: inmemory
    filesystem:
        rootdirectory: /var/lib/registry
http:
    addr: :5000
    headers:
        X-Content-Type-Options: [nosniff]
health:
  storagedriver:
    enabled: true
    interval: 10s
    threshold: 3
proxy:
  remoteurl: https://registry-1.docker.io

注册表2.0错误:

registry_1 | time="2015-11-11T21:14:07Z" level=warning msg="No HTTP secret provided - generated random secret. This may cause problems with uploads if multiple registries are behind a load-balancer. To provide a shared secret, fill in http.secret in the configuration file or set the REGISTRY_HTTP_SECRET environment variable." go.version=go1.4.3 instance.id=9d59c958-6764-4951-b438-c8280e5a6c62 version=v2.2.0 
registry_1 | time="2015-11-11T21:14:07Z" level=info msg="redis not configured" go.version=go1.4.3 instance.id=9d59c958-6764-4951-b438-c8280e5a6c62 version=v2.2.0 
registry_1 | time="2015-11-11T21:14:07Z" level=info msg="using inmemory blob descriptor cache" go.version=go1.4.3 instance.id=9d59c958-6764-4951-b438-c8280e5a6c62 version=v2.2.0 
registry_1 | time="2015-11-11T21:14:07Z" level=info msg="Starting cached object TTL expiration scheduler..." go.version=go1.4.3 instance.id=9d59c958-6764-4951-b438-c8280e5a6c62 version=v2.2.0 
registry_1 | time="2015-11-11T21:14:07Z" level=info msg="Starting upload purge in 8m0s" go.version=go1.4.3 instance.id=9d59c958-6764-4951-b438-c8280e5a6c62 version=v2.2.0 
**registry_1 | panic: Get https://registry-1.docker.io/v2/: Forbidden**
registry_1 | 
registry_1 | goroutine 1 [running]:
registry_1 | github.com/docker/distribution/registry/handlers.NewApp(0x7f7cf75022d8, 0xc208138300, 0xc208118500, 0x7f7cf75022d8)
registry_1 |    /go/src/github.com/docker/distribution/registry/handlers/app.go:246 +0x25dc
registry_1 | github.com/docker/distribution/registry.NewRegistry(0x7f7cf7502318, 0xc208138300, 0xc208118500, 0xc208118500, 0x0, 0x0)
registry_1 |    /go/src/github.com/docker/distribution/registry/registry.go:94 +0x2d4
registry_1 | github.com/docker/distribution/registry.func·001(0x1299880, 0xc20802b520, 0x1, 0x1)
registry_1 |    /go/src/github.com/docker/distribution/registry/registry.go:57 +0x2d1
registry_1 | github.com/spf13/cobra.(*Command).execute(0x1299880, 0xc20800a010, 0x1, 0x1, 0x0, 0x0)
registry_1 |    /go/src/github.com/docker/distribution/Godeps/_workspace/src/github.com/spf13/cobra/command.go:495 +0x65c
registry_1 | github.com/spf13/cobra.(*Command).Execute(0x1299880, 0x0, 0x0)
registry_1 |    /go/src/github.com/docker/distribution/Godeps/_workspace/src/github.com/spf13/cobra/command.go:560 +0x18d
registry_1 | main.main()
registry_1 |    /go/src/github.com/docker/distribution/cmd/registry/main.go:22 +0x2a
registry_1 | 
registry_1 | goroutine 9 [syscall]:
registry_1 | os/signal.loop()
registry_1 |    /usr/src/go/src/os/signal/signal_unix.go:21 +0x1f
registry_1 | created by os/signal.init·1
registry_1 |    /usr/src/go/src/os/signal/signal_unix.go:27 +0x35
registry_1 | 
registry_1 | goroutine 11 [sleep]:
registry_1 | github.com/docker/distribution/registry/handlers.func·009()
registry_1 |    /go/src/github.com/docker/distribution/registry/handlers/app.go:938 +0x203
registry_1 | created by github.com/docker/distribution/registry/handlers.startUploadPurger
registry_1 |    /go/src/github.com/docker/distribution/registry/handlers/app.go:945 +0x942
registry_1 | 
registry_1 | goroutine 12 [select]:
registry_1 | github.com/docker/distribution/notifications.(*Broadcaster).run(0xc2081385d0)
registry_1 |    /go/src/github.com/docker/distribution/notifications/sinks.go:80 +0x604
registry_1 | created by github.com/docker/distribution/notifications.NewBroadcaster
registry_1 |    /go/src/github.com/docker/distribution/notifications/sinks.go:39 +0xea
registry_1 | 
registry_1 | goroutine 13 [select]:
registry_1 | github.com/docker/distribution/registry/proxy/scheduler.func·001()
registry_1 |    /go/src/github.com/docker/distribution/registry/proxy/scheduler/scheduler.go:133 +0x2d1
registry_1 | created by github.com/docker/distribution/registry/proxy/scheduler.(*TTLExpirationScheduler).Start
registry_1 |    /go/src/github.com/docker/distribution/registry/proxy/scheduler/scheduler.go:152 +0x39a
registry_1 | 
registry_1 | goroutine 17 [syscall, locked to thread]:
registry_1 | runtime.goexit()
registry_1 |    /usr/src/go/src/runtime/asm_amd64.s:2232 +0x1
registry_registry_1 exited with code 2

任何想法?

谢谢!

docker docker-registry
1个回答
0
投票

人,

我发现了为什么不起作用:

域注册表-1.docker.io在我的/ etc / hosts文件中作为其他IP地址存在,仅用于反向代理。

问题是此反向代理正在请求身份验证。我使用了带有HTTP_PROXY变量的传统代理,并且可以正常工作。

:D

© www.soinside.com 2019 - 2024. All rights reserved.