当前位置:   article > 正文

docker-registry-web

docker-registry-web

摘录自:https://github.com/mkuchin/docker-registry-web

Web UI, authentication service and event recorder for private docker registry v2.

Docker Stars Docker Pulls

Features:

  • Browsing repositories, tags and images in docker registry v2
  • Optional token based authentication provider with role-based permissions
  • Docker registry notification recording and audit

Warning: this version config is not compatible with configuration of versions prior 0.1.0

Migrating configuration from 0.0.4 to 0.1.x

Docker pull command

docker pull hyper/docker-registry-web

How to run

Quick start (config with environment variables, no authentication)

Do not use registry as registry container name, it will break REGISTRY_NAME environment variable.

  1. docker run -d -p 5000:5000 --name registry-srv registry:2
  2. docker run -it -p 8080:8080 --name registry-web --link registry-srv -e REGISTRY_URL=http://registry-srv:5000/v2 -e REGISTRY_NAME=localhost:5000 hyper/docker-registry-web
Connecting to docker registry with basic authentication and self-signed certificate
  1. docker run -it -p 8080:8080 --name registry-web --link registry-srv \
  2. -e REGISTRY_URL=https://registry-srv:5000/v2 \
  3. -e REGISTRY_TRUST_ANY_SSL=true \
  4. -e REGISTRY_BASIC_AUTH="YWRtaW46Y2hhbmdlbWU=" \
  5. -e REGISTRY_NAME=localhost:5000 hyper/docker-registry-web
No authentication, with config file
  1. Create configuration file config.yml

    (Any property in this config may be overridden with environment variable, for example property registry.auth.enabledwill become REGISTRY_AUTH_ENABLED)

    1. registry:
    2. # Docker registry url
    3. url: http://registry-srv:5000/v2
    4. # Docker registry fqdn
    5. name: localhost:5000
    6. # To allow image delete, should be false
    7. readonly: false
    8. auth:
    9. # Disable authentication
    10. enabled: false
  2. Run with docker

    1. docker run -p 5000:5000 --name registry-srv -d registry:2
    2. docker run -it -p 8080:8080 --name registry-web --link registry-srv -v $(pwd)/config.yml:/conf/config.yml:ro hyper/docker-registry-web
  3. Web UI will be available on http://localhost:8080

With authentication enabled

Token authentication requires RSA private key in PEM format and certificate matched with this key

  1. Generate private key and certificate

    1. mkdir conf
    2. openssl req -new -newkey rsa:4096 -days 365 -subj "/CN=localhost" \
    3. -nodes -x509 -keyout conf/auth.key -out conf/auth.cert
  2. Create registry config conf/registry-srv.yml

    1. version: 0.1
    2. storage:
    3. filesystem:
    4. rootdirectory: /var/lib/registry
    5. http:
    6. addr: 0.0.0.0:5000
    7. auth:
    8. token:
    9. # external url to docker-web authentication endpoint
    10. realm: http://localhost:8080/api/auth
    11. # should be same as registry.name of registry-web
    12. service: localhost:5000
    13. # should be same as registry.auth.issuer of registry-web
    14. issuer: 'my issuer'
    15. # path to auth certificate
    16. rootcertbundle: /etc/docker/registry/auth.cert
  3. Start docker registry

    1. docker run -v $(pwd)/conf/registry-srv.yml:/etc/docker/registry/config.yml:ro \
    2. -v $(pwd)/conf/auth.cert:/etc/docker/registry/auth.cert:ro -p 5000:5000 --name registry-srv -d registry:2
  4. Create configuration file conf/registry-web.yml

    1. registry:
    2. # Docker registry url
    3. url: http://registry-srv:5000/v2
    4. # Docker registry fqdn
    5. name: localhost:5000
    6. # To allow image delete, should be false
    7. readonly: false
    8. auth:
    9. # Enable authentication
    10. enabled: true
    11. # Token issuer
    12. # should equals to auth.token.issuer of docker registry
    13. issuer: 'my issuer'
    14. # Private key for token signing
    15. # certificate used on auth.token.rootcertbundle should signed by this key
    16. key: /conf/auth.key
  5. Start registry-web

    1. docker run -v $(pwd)/conf/registry-web.yml:/conf/config.yml:ro \
    2. -v $(pwd)/conf/auth.key:/conf/auth.key -v $(pwd)/db:/data \
    3. -it -p 8080:8080 --link registry-srv --name registry-web hyper/docker-registry-web
  6. Web UI will be available on http://localhost:8080 with default admin user/password admin/admin.

Role system

After first start you will have following roles:

  • UI_ADMIN
  • UI_USER
  • UI_DELETE
  • read-all
  • write-all

You can't delete or modify UI_ADMIN and UI_USER role, they are special roles and allows admin or user access to UI respectively.
User access allows to browse registry, admin access allows to create, delete and modify users and roles in addition to user access.

UI_DELETE role allows deleting images in the UI based on ACLs.

Every non-special role has a list of ACLs, each of ACL grants permission grants permission to pullpull+push or pull+push+delete based on IP and image name glob matching. For example read-all role matches any IP and any image name with glob * and grants pull permission and write-all role grants pull+push permission for any IP and any image name.

Configuration reference

Docker Compose configuration examples


Migrating configuration from 0.0.4 to 0.1.x

config option in 0.0.4config option in 0.1.xComment
REGISTRY_HOSTREGISTRY_URLURL should start with protocol, e.g. https://registry-srv:5000/v2
REGISTRY_PORT
REGISTRY_NAMEREGISTRY_NAMEvisible name of registry
REGISTRY_AUTHREGISTRY_BASIC_AUTHBase64 encoded authentication string, e.g. YWRtaW46Y2hhbmdlbWU=
READONLYREGISTRY_READONLYtrue|false
TRUST_ANY_SSLREGISTRY_TRUST_ANY_SSLtrue|false
CONTEXT_PATHREGISTRY_CONTEXT_PATHurl prefix if you need to host web registry on non-root path
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/95806
推荐阅读
相关标签
  

闽ICP备14008679号