目录

1. 示例配置 

2. 选项 

1.版本信息 

2.log选项

3.hooks选项 

4.存储选项 

5.认证选项 

6.HTTP选项 

7.通知选项 

8.redis选项 

9.健康监控选项

10.代理选项

11.验证选项 

 👑👑👑结束语👑👑👑


1. 示例配置 

version: 0.1
log:
    level: debug
    fields:
        service: registry
        environment: development
    hooks:
        - type: mail
            disabled: true
            levels:
                - panic
            options:
                smtp:
                    addr: mail.example.com:25
                    username: mailuser
                    password: password
                    insecure: true
                from: sender@example.com
                to:
                    - errors@example.com
storage:
        delete:
            enabled: true
        cache:
                blobdescriptor: redis
        filesystem:
                rootdirectory: /var/lib/registry
        maintenance:
                uploadpurging:
                    enabled: false
http:
        addr: :5000
        debug:
                addr: localhost:5001
        headers:
                X-Content-Type-Options: [nosniff]
redis:
        addr: localhost:6379
        pool:
            maxidle: 16
            maxactive: 64
            idletimeout: 300s
        dialtimeout: 10ms
        readtimeout: 10ms
        writetimeout: 10ms
notifications:
    endpoints:
        - name: local-5003
            url: http://localhost:5003/callback
            headers:
                Authorization: [Bearer <an example token>]
                timeout: 1s
                threshold: 10
                backoff: 1s
                disabled: true
            - name: local-8083
                url: http://localhost:8083/callback
                timeout: 1s
                threshold: 10
                backoff: 1s
                disabled: true
health:
    storagedriver:
        enabled: true
        interval: 10s
        threshold: 3

 

2. 选项 

export LOG_LEVEL=debug

1.版本信息 

version:0.1

2.log选项

log:
    level: debug
    formatter: text
    fields:
        service: registry
        environment: staging

3.hooks选项 

hooks:
    - type: mail
        levels:
            - panic
        options:
            smtp:
                addr: smtp.sendhost.com:25
                username: sendername
                password: password
                insecure: true
            from: name@sendhost.com
            to:
                - name@receivehost.com

4.存储选项 

storage:
    filesystem:
        rootdirectory: /var/lib/registry
    azure:
        accountname: accountname
        accountkey: base64encodedaccountkey
        container: containername
    gcs:
        bucket: bucketname
        keyfile: /path/to/keyfile
        rootdirectory: /gcs/object/name/prefix
    s3:
        accesskey: awsaccesskey
        secretkey: awssecretkey
        region: us-west-1
        regionendpoint: http://myobjects.local
        bucket: bucketname
        encrypt: true
        keyid: mykeyid
        secure: true
        v4auth: true
        chunksize: 5242880
        multipartcopychunksize: 33554432
        multipartcopymaxconcurrency: 100
        multipartcopythresholdsize: 33554432
        rootdirectory: /s3/object/name/prefix
swift:
        username: username
        password: password
        authurl: https://storage.myprovider.com/auth/v1.0 or https://storage.
        myprovider.com/v2.0 or https://storage.myprovider.com/v3/auth
        tenant: tenantname
        tenantid: tenantid
        domain: domain name for Openstack Identity v3 API
        domainid: domain id for Openstack Identity v3 API
        insecureskipverify: true
        region: fr
        container: containername
        rootdirectory: /swift/object/name/prefix
oss:
        accesskeyid: accesskeyid
        accesskeysecret: accesskeysecret
        region: OSS region name
        endpoint: optional endpoints
        internal: optional internal endpoint
        bucket: OSS bucket
        encrypt: optional data encryption setting
        secure: optional ssl setting
        chunksize: optional size valye
        rootdirectory: optional root directory
inmemory:
delete:
    enabled: false
cache:
    blobdescriptor: inmemory
maintenance:
    uploadpurging:
        enabled: true
        age: 168h
        interval: 24h
        dryrun: false
redirect:
    disable: false

5.认证选项 

auth:
    silly:
        realm: silly-realm
        service: silly-service
    token:
        realm: token-realm
        service: token-service
        issuer: registry-token-issuer
        rootcertbundle: /root/certs/bundle
    htpasswd:
        realm: basic-realm
path: /path/to/htpasswd

6.HTTP选项 

http:
    addr: localhost:5000
    net: tcp
    prefix: /my/nested/registry/
    host: https://myregistryaddress.org:5000
    secret: asecretforlocaldevelopment
    relativeurls: false
    tls:
        certificate: /path/to/x509/public
        key: /path/to/x509/private
        clientcas:
            - /path/to/ca.pem
            - /path/to/another/ca.pem
        letsencrypt:
            cachefile: /path/to/cache-file
            email: emailused@letsencrypt.com
debug:
    addr: localhost:5001
headers:
    X-Content-Type-Options: [nosniff]
http2:
    disabled: false

7.通知选项 

notifications:
    endpoints:
        - name: alistener
            disabled: false
                url: https://my.listener.com/event
                headers: <http.Header>
                timeout: 500
                threshold: 5
                backoff: 1000

8.redis选项 

redis:
    addr: localhost:6379
    password: asecret
    db: 0
    dialtimeout: 10ms
    readtimeout: 10ms
    writetimeout: 10ms
    pool:
        maxidle: 16
        maxactive: 64
        idletimeout: 300s

9.健康监控选项 

health:
    storagedriver:
        enabled: true
        interval: 10s
        threshold: 3
    file:
        - file: /path/to/checked/file
            interval: 10s
    http:
        - uri: http://server.to.check/must/return/200
            headers:
                Authorization: [Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==]
            statuscode: 200
            timeout: 3s
            interval: 10s
            threshold: 3
tcp:
    - addr: redis-server.domain.com:6379
        timeout: 3s
        interval: 10s
        threshold: 3

10.代理选项

proxy:
    remoteurl: https://registry-1.docker.io
    username: [username]
    password: [password]
$ docker --registry-mirror=https://myrepo.com:5000 daemon

11.验证选项 

validation:
    enabled: true
    manifests:
        urls:
        allow:
            - ^https?://([^/]+\.)*example\.com/
        deny:
            - ^https?://www\.example\.com/

 👑👑👑结束语👑👑👑

【云原生 | 45】Docker搭建Registry私有仓库之配置Registry详解-LMLPHP

11-24 07:06