From 29c17b1baa5c9ad75b1328cc4cc757f34e4d6dd6 Mon Sep 17 00:00:00 2001 From: Joxit Date: Fri, 5 Nov 2021 22:39:19 +0100 Subject: [PATCH] docs: add documentation + example for DEFAULT_REGISTRIES and READ_ONLY_REGISTRIES --- README.md | 7 +++++- bin/entrypoint | 16 ++++++------ examples/README.md | 3 ++- examples/pr-219/README.md | 14 +++++++++++ examples/pr-219/docker-compose.yml | 39 ++++++++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 10 deletions(-) create mode 100644 examples/pr-219/README.md create mode 100644 examples/pr-219/docker-compose.yml diff --git a/README.md b/README.md index 4c3a305..767b35b 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,8 @@ This web user interface uses [Riot](https://github.com/Riot/riot) the react-like - Show/Hide content digest in taglist via `SHOW_CONTENT_DIGEST` (values are: [`true`, `false`], default: `false`) (see [#126](https://github.com/Joxit/docker-registry-ui/issues/126)). - Limit the number of elements in the image list via `CATALOG_ELEMENTS_LIMIT` (see [#127](https://github.com/Joxit/docker-registry-ui/pull/127)). - Multi arch support in history page (see [#130](https://github.com/Joxit/docker-registry-ui/issues/130) and [#134](https://github.com/Joxit/docker-registry-ui/pull/134)) +- Set a list of default registries with `DEFAULT_REGISTRIES` (see [#219](https://github.com/Joxit/docker-registry-ui/pull/219)). +- Desactivate add and remove regisitries with `READ_ONLY_REGISTRIES` (see [#219](https://github.com/Joxit/docker-registry-ui/pull/219)). ## FAQ @@ -85,9 +87,11 @@ Some env options are available for use this interface for **only one server**. - `DELETE_IMAGES`: Set if we can delete images from the UI. (default: `false`) - `SHOW_CONTENT_DIGEST`: Show content digest in docker tag list. (default: `false`) - `CATALOG_ELEMENTS_LIMIT`: Limit the number of elements in the catalog page. (default: `100000`). -- `SINGLE_REGISTRY`: Remove the menu that show the dialogs to add, remove and change the endpoint of your docker registry. (default `false`) +- `SINGLE_REGISTRY`: Remove the menu that show the dialogs to add, remove and change the endpoint of your docker registry. (default: `false`). - `NGINX_PROXY_PASS_URL`: Update the default Nginx configuration and set the **proxy_pass** to your backend docker registry (this avoid CORS configuration). This is usually the name of your registry container in the form `http://registry:5000`. - `NGINX_PROXY_HEADER_*`: Update the default Nginx configuration and set **custom headers** for your backend docker registry. Only when `NGINX_PROXY_PASS_URL` is used. +- `DEFAULT_REGISTRIES`: List of comma separated registry URLs (e.g `http://registry.example.com,http://registry:5000`), available only when `SINGLE_REGISTRY=false`. (default: ` `). +- `READ_ONLY_REGISTRIES`: Desactivate dialog for remove and add new registries, available only when `SINGLE_REGISTRY=false`. (default: `false`). 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/main/examples/ui-as-proxy/) or docker-registry-ui as standalone [here](https://github.com/Joxit/docker-registry-ui/tree/main/examples/ui-as-standalone/). @@ -182,3 +186,4 @@ check out the [Electron](examples/electron/README.md) standalone application. - [UI showing same sha256 content digest for all tags + Delete is not working](https://github.com/Joxit/docker-registry-ui/tree/main/examples/issue-116) ([#116](https://github.com/Joxit/docker-registry-ui/issues/116)) - [Electron-based Standalone Application](https://github.com/Joxit/docker-registry-ui/tree/main/examples/electron) ([#129](https://github.com/Joxit/docker-registry-ui/pull/129)) - [Use docker-registry-ui as proxy with read-only right](https://github.com/Joxit/docker-registry-ui/tree/main/examples/read-only-auth) ([#47](https://github.com/Joxit/docker-registry-ui/issues/47)) +- [Use DEFAULT_REGISTRIES and READ_ONLY_REGISTRIES](https://github.com/Joxit/docker-registry-ui/tree/main/examples/pr-219) ([#219](https://github.com/Joxit/docker-registry-ui/issues/219)) diff --git a/bin/entrypoint b/bin/entrypoint index ba00391..1cb40e5 100755 --- a/bin/entrypoint +++ b/bin/entrypoint @@ -1,13 +1,13 @@ #!/bin/sh -sed -i "s,\${REGISTRY_URL},${REGISTRY_URL}," index.html -sed -i "s,\${REGISTRY_TITLE},${REGISTRY_TITLE}," index.html -sed -i "s,\${PULL_URL},${PULL_URL}," index.html -sed -i "s,\${SINGLE_REGISTRY},${SINGLE_REGISTRY}," index.html -sed -i "s/\${CATALOG_ELEMENTS_LIMIT}/${CATALOG_ELEMENTS_LIMIT}/" index.html -sed -i "s/\${SHOW_CONTENT_DIGEST}/${SHOW_CONTENT_DIGEST}/" index.html -sed -i "s/\${DEFAULT_REGISTRIES}/${DEFAULT_REGISTRIES}/" index.html -sed -i "s/\${READ_ONLY_REGISTRIES}/${READ_ONLY_REGISTRIES}/" index.html +sed -i "s~\${REGISTRY_URL}~${REGISTRY_URL}~" index.html +sed -i "s~\${REGISTRY_TITLE}~${REGISTRY_TITLE}~" index.html +sed -i "s~\${PULL_URL}~${PULL_URL}~" index.html +sed -i "s~\${SINGLE_REGISTRY}~${SINGLE_REGISTRY}~" index.html +sed -i "s~\${CATALOG_ELEMENTS_LIMIT}~${CATALOG_ELEMENTS_LIMIT}~" index.html +sed -i "s~\${SHOW_CONTENT_DIGEST}~${SHOW_CONTENT_DIGEST}~" index.html +sed -i "s~\${DEFAULT_REGISTRIES}~${DEFAULT_REGISTRIES}~" index.html +sed -i "s~\${READ_ONLY_REGISTRIES}~${READ_ONLY_REGISTRIES}~" index.html if [ -z "${DELETE_IMAGES}" ] || [ "${DELETE_IMAGES}" = false ] ; then sed -i "s/\${DELETE_IMAGES}/false/" index.html diff --git a/examples/README.md b/examples/README.md index 1439e1c..197cfad 100644 --- a/examples/README.md +++ b/examples/README.md @@ -10,4 +10,5 @@ - [Add custom headers bases on environment variable and/or file when the ui is used as proxy](https://github.com/Joxit/docker-registry-ui/tree/main/examples/proxy-headers) ([#89](https://github.com/Joxit/docker-registry-ui/pull/89)) - [UI showing same sha256 content digest for all tags + Delete is not working](https://github.com/Joxit/docker-registry-ui/tree/main/examples/issue-116) ([#116](https://github.com/Joxit/docker-registry-ui/issues/116)) - [Electron-based Standalone Application](https://github.com/Joxit/docker-registry-ui/tree/main/examples/electron) ([#129](https://github.com/Joxit/docker-registry-ui/pull/129)) -- [Use docker-registry-ui as proxy with read-only right](https://github.com/Joxit/docker-registry-ui/tree/main/examples/read-only-auth) ([#47](https://github.com/Joxit/docker-registry-ui/issues/47)) \ No newline at end of file +- [Use docker-registry-ui as proxy with read-only right](https://github.com/Joxit/docker-registry-ui/tree/main/examples/read-only-auth) ([#47](https://github.com/Joxit/docker-registry-ui/issues/47)) +- [Use DEFAULT_REGISTRIES and READ_ONLY_REGISTRIES](https://github.com/Joxit/docker-registry-ui/tree/main/examples/pr-219) ([#219](https://github.com/Joxit/docker-registry-ui/issues/219)) \ No newline at end of file diff --git a/examples/pr-219/README.md b/examples/pr-219/README.md new file mode 100644 index 0000000..9acc51c --- /dev/null +++ b/examples/pr-219/README.md @@ -0,0 +1,14 @@ +# Example for pull request #219 + +Basic usage for `DEFAULT_REGISTRIES` and `READ_ONLY_REGISTRIES`. + +Behaviors: +- `DEFAULT_REGISTRIES`: + - will set the list of registries in the localstorage when the localstorage is empty. + - will overwrite the list of registries every time when `READ_ONLY_REGISTRIES=true` +- `READ_ONLY_REGISTRIES`: + - will remove dialog for Add and Remove registries + +These options works only when `SINGLE_REGISTRY=false` + +See [#219](https://github.com/Joxit/docker-registry-ui/pull/219) \ No newline at end of file diff --git a/examples/pr-219/docker-compose.yml b/examples/pr-219/docker-compose.yml new file mode 100644 index 0000000..4812a00 --- /dev/null +++ b/examples/pr-219/docker-compose.yml @@ -0,0 +1,39 @@ +version: '2' + +services: + registry_1: + image: registry:latest + restart: always + ports: + - 5000:5000 + container_name: registry_1 + environment: + REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: "['*']" + REGISTRY_STORAGE_DELETE_ENABLED: 'true' + volumes: + - ./data:/var/lib/registry + + registry_2: + image: registry:latest + restart: always + ports: + - 5001:5000 + container_name: registry_2 + environment: + REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: "['*']" + REGISTRY_STORAGE_DELETE_ENABLED: 'true' + volumes: + - ./data:/var/lib/registry + + ui: + image: joxit/docker-registry-ui:latest + restart: always + container_name: registry-ui + environment: + - REGISTRY_TITLE=Private Docker Registry + - DEFAULT_REGISTRIES=http://localhost:5000,http://localhost:5001 + - DELETE_IMAGES=true + - READ_ONLY_REGISTRIES=true + - SINGLE_REGISTRY=false + ports: + - 80:80 \ No newline at end of file