私有仓库如何查看详细信息

尝试下 docker-registry-web

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
docker run -it -p 8080:8080 --name registry-web --link registry-srv \
           -e REGISTRY_URL=https://registry-srv:5000/v2 \
           -e REGISTRY_TRUST_ANY_SSL=true \
           -e REGISTRY_BASIC_AUTH="YWRtaW46Y2hhbmdlbWU=" \
           -e REGISTRY_NAME=localhost:5000 hyper/docker-registry-web

192.168.3.228测试

拉取镜像

docker pull hyper/docker-registry-web
docker run -it -p 4050:8080 --name registry-web --link registry-srv \
           -e REGISTRY_URL=https://reg.ops.ac.cn:5000/v2 \
           -e REGISTRY_TRUST_ANY_SSL=true \
           -e REGISTRY_BASIC_AUTH="b3BzOjEyMzEyMw==" \
           -e REGISTRY_NAME=localhost:5000 hyper/docker-registry-web

需要注意:

  • BASIC AUTH可以由php代码拿到
  • #!/usr/bin/php
    <?php
    $username="ops";
    $password="123123";
    $header = "Authorization: Basic " . base64_encode($username . ':' . $password);
    echo $header
    ?>
    

或者

echo "ops:123123" | base64

参考

其实这个也是可以挂载私服并进行权限认证

https://github.com/mkuchin/docker-registry-web#connecting-to-docker-registry-with-basic-authentication-and-self-signed-certificate

https://github.com/mkuchin/docker-registry-web/tree/master/examples

和私服 SSL证书验证

docker-registry-web配置

registry:
  # Docker registry url
  url: http://reg.ops.ac.cn:5000/v2
  # Docker registry fqdn
  name: reg.ops.ac.cn:5000
  # To allow image delete, should be false
  readonly: false
  auth:
    # Enable authentication
    enabled: false
    # Token issuer
    # should equals to auth.token.issuer of docker registry
    issuer: 'my issuer'
    # Private key for token signing
    # certificate used on auth.token.rootcertbundle should signed by this key
    key: /conf/auth.key

私服配置

version: 0.1
log:
  fields:
    service: registry
storage:
    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
auth:
  enable: false
  token:
    realm: http://reg.ops.ac.cn:4050/api/auth
    service: "/registry-web/registry"
    issuer: "my issuer"
    rootcertbundle: /etc/docker/registry/auth.cert

不带有验证的配置,不带有任何验证

docker registry-web

#!/bin/bash

docker stop registry-web
docker rm registry-web
docker stop registry-web-test
docker rm registry-web-test

docker run -itd -p 4050:8080 --name registry-web --link registry \
           -e REGISTRY_URL=https://reg.ops.ac.cn:5000/v2 \
           -e REGISTRY_BASIC_AUTH="b3BzOjEyMzEyMw==" \
           -e REGISTRY_TRUST_ANY_SSL=true \
           -e REGISTRY_NAME=reg.ops.ac.cn:5000 hyper/docker-registry-web
           #-e REGISTRY_BASIC_AUTH="b3BzOjEyMzEyMw==" \
           #-e REGISTRY_TOKEN_AUTH="b3BzOjEyMzEyMzEyMw==" \

docker ps | grep registry | grep web | awk '{print $1}' | xargs -i docker logs -f --tail 40 {}

docker registry

#!/bin/bash

docker stop  registry
docker rm registry

docker run -d \
-p 5000:5000 \
--restart=always \
--name registry \
-v `pwd`/auth:/auth \
-e "REGISTRY_AUTH=htpasswd" \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
-v `pwd`/certs:/certs \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/registry.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/registry.key \
-v /data:/var/lib/registry registry:2.3
Copyright © opschina.org 2017 with zzlyzq@gmail.com all right reserved,powered by Gitbook该文件修订时间: 2017-07-11 11:32:48

results matching ""

    No results matching ""