diff --git a/.gitignore b/.gitignore index 6d6a4c8..476bcfa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .project node_modules package-lock.json +registry-data diff --git a/README.md b/README.md index 5c87921..f3949f4 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,8 @@ docker run -d --net registry-ui-net --name registry-srv registry:2 docker run -d --net registry-ui-net -p 80:80 -e REGISTRY_URL=http://registry-srv:5000 -e DELETE_IMAGES=true -e REGISTRY_TITLE="My registry" joxit/docker-registry-ui:static ``` +There are some examples with [docker-compose](https://docs.docker.com/compose/) and docker-registry-ui as proxy [here](https://github.com/Joxit/docker-registry-ui/tree/master/examples/ui-as-proxy/). + ## Using CORS Your server should be configured to accept CORS. diff --git a/examples/ui-as-proxy/README.md b/examples/ui-as-proxy/README.md new file mode 100644 index 0000000..87362ae --- /dev/null +++ b/examples/ui-as-proxy/README.md @@ -0,0 +1,21 @@ +# Docker Registry Static as proxy example + +You can set up the static user interface as proxy in several ways. + +If you want to populate your registry, use `populate.sh` script. +The interface will be accessible with . + +The simplest way is with `simple.yml` docker-compose file. + +```sh +docker-compose -f simple.yml up -d +./populate.sh +``` + +You can add some credentials to access your registry wit `credentials.yml` docker-compose file. +Credentials for this example are login: `registry` and password: `ui` using bcrypt. + +```sh +docker-compose -f credentials.yml up -d +./populate.sh +``` diff --git a/examples/ui-as-proxy/credentials.yml b/examples/ui-as-proxy/credentials.yml new file mode 100644 index 0000000..b9dade2 --- /dev/null +++ b/examples/ui-as-proxy/credentials.yml @@ -0,0 +1,25 @@ +version: '2.0' +services: + registry: + image: registry:2.6.2 + volumes: + - ./registry-data:/var/lib/registry + - ./registry-config/credentials.yml:/etc/docker/registry/config.yml + - ./registry-config/htpasswd:/etc/docker/registry/htpasswd + networks: + - registry-ui-net + + ui: + image: joxit/docker-registry-ui:static + ports: + - 80:80 + environment: + - REGISTRY_TITLE=My Private Docker Registry + - REGISTRY_URL=http://registry:5000 + depends_on: + - registry + networks: + - registry-ui-net + +networks: + registry-ui-net: \ No newline at end of file diff --git a/examples/ui-as-proxy/populate.sh b/examples/ui-as-proxy/populate.sh new file mode 100644 index 0000000..801433d --- /dev/null +++ b/examples/ui-as-proxy/populate.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +docker tag joxit/docker-registry-ui:static localhost/joxit/docker-registry-ui:static +docker tag joxit/docker-registry-ui:static localhost/joxit/docker-registry-ui:0.3 +docker tag joxit/docker-registry-ui:static localhost/joxit/docker-registry-ui:0.3.0 +docker tag joxit/docker-registry-ui:static localhost/joxit/docker-registry-ui:0.3.0-static +docker tag joxit/docker-registry-ui:static localhost/joxit/docker-registry-ui:0.3-static + +docker push localhost/joxit/docker-registry-ui + +docker tag registry:2.6.2 localhost/registry:latest +docker tag registry:2.6.2 localhost/registry:2.6.2 +docker tag registry:2.6.2 localhost/registry:2.6 +docker tag registry:2.6.2 localhost/registry:2.6.0 +docker tag registry:2.6.2 localhost/registry:2 + +docker push localhost/registry \ No newline at end of file diff --git a/examples/ui-as-proxy/registry-config/credentials.yml b/examples/ui-as-proxy/registry-config/credentials.yml new file mode 100644 index 0000000..31dd619 --- /dev/null +++ b/examples/ui-as-proxy/registry-config/credentials.yml @@ -0,0 +1,25 @@ +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] + Access-Control-Allow-Origin: ['http://localhost'] + Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS', 'DELETE'] + Access-Control-Allow-Headers: ['Authorization'] + Access-Control-Max-Age: [1728000] + Access-Control-Allow-Credentials: [true] + Access-Control-Expose-Headers: ['Docker-Content-Digest'] +auth: + htpasswd: + realm: basic-realm + path: /etc/docker/registry/htpasswd \ No newline at end of file diff --git a/examples/ui-as-proxy/registry-config/htpasswd b/examples/ui-as-proxy/registry-config/htpasswd new file mode 100644 index 0000000..b5767d7 --- /dev/null +++ b/examples/ui-as-proxy/registry-config/htpasswd @@ -0,0 +1 @@ +registry:$2y$11$1bmuJLK8HrQl5ACS/WeqRuJLUArUZfUcP2R23asmozEpfN76.pCHy \ No newline at end of file diff --git a/examples/ui-as-proxy/simple.yml b/examples/ui-as-proxy/simple.yml new file mode 100644 index 0000000..813e801 --- /dev/null +++ b/examples/ui-as-proxy/simple.yml @@ -0,0 +1,23 @@ +version: '2.0' +services: + registry: + image: registry:2.6.2 + volumes: + - ./registry-data:/var/lib/registry + networks: + - docker-registry-ui + + ui: + image: joxit/docker-registry-ui:static + ports: + - 80:80 + environment: + - REGISTRY_TITLE=My Private Docker Registry + - REGISTRY_URL=http://registry:5000 + depends_on: + - registry + networks: + - docker-registry-ui + +networks: + registry-ui-net: \ No newline at end of file