commit 5c3455f1c2f7b56d8c135a537b3258fbc4671fb4 Author: greg Date: Fri Nov 17 10:01:04 2023 +0100 push registry v2 diff --git a/README.md b/README.md new file mode 100644 index 0000000..4dc4fbf --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# DOCKER REGISTRE AVEC UI + +Ce projet a pour but d'instancier un registre Docker sécurisé par mot de passe et +accessible via une UI. Votre Docker Hub! + +### CREATION D'UN PASSWORD: + +Ici, remplacer testuser et testpassword par le nom d'utilisateur et le mot de passe désiré. +```sh +sudo apt-get install apache2-utils +htpasswd -Bbn testuser testpassword > registry-config/htpasswd +``` + +### LANCER LA STACK +```sh +docker-compose up -d +``` + +### SE CONNECTER A L'ADRESSE: +http://locahost:8087 + +### POUSSER UNE IMAGE: + +Login au docker registry (nécessaire une fois): +```sh +docker login localhost:5000 +``` + +Entrer l'utilisateur et le mot de passe créés plus tôt, puis: +```sh +docker tag localhost/mon_image:tag +docker push localhost/mon_image:tag +``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b43ae4a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,43 @@ +version: '3.8' + +services: + registry-ui: + image: joxit/docker-registry-ui:main + container_name: registry-ui + restart: always + ports: + - 8087:80 + environment: + - SINGLE_REGISTRY=true + - REGISTRY_TITLE=Docker Registry UI + - DELETE_IMAGES=true + - SHOW_CONTENT_DIGEST=true + - NGINX_PROXY_PASS_URL=http://registry:5000 + - SHOW_CATALOG_NB_TAGS=true + - CATALOG_MIN_BRANCHES=1 + - CATALOG_MAX_BRANCHES=1 + - TAGLIST_PAGE_SIZE=100 + - REGISTRY_SECURED=false + - CATALOG_ELEMENTS_LIMIT=1000 + networks: + - registry-ui-net + + registry: + image: registry:2.8.2 + container_name: registry + restart: always + environment: + REGISTRY_HTTP_HEADERS_Access-Control-Origin: '[http://registry.example.com]' + REGISTRY_HTTP_HEADERS_Access-Control-Allow-Methods: '[HEAD,GET,OPTIONS,DELETE]' + REGISTRY_HTTP_HEADERS_Access-Control-Credentials: '[true]' + REGISTRY_HTTP_HEADERS_Access-Control-Allow-Headers: '[Authorization,Accept,Cache-Control]' + REGISTRY_HTTP_HEADERS_Access-Control-Expose-Headers: '[Docker-Content-Digest]' + REGISTRY_STORAGE_DELETE_ENABLED: 'true' + volumes: + - ./registry/data:/var/lib/registry + - ./registry-config:/etc/docker/registry + networks: + - registry-ui-net + +networks: + registry-ui-net: \ No newline at end of file diff --git a/registry-config/config.yml b/registry-config/config.yml new file mode 100644 index 0000000..932bfea --- /dev/null +++ b/registry-config/config.yml @@ -0,0 +1,39 @@ +version: 0.1 +log: + fields: + service: registry +storage: + delete: + enabled: true + cache: + blobdescriptor: inmemory + filesystem: + rootdirectory: /var/lib/registry + maintenance: + uploadpurging: + enabled: true + age: 168h + interval: 24h + dryrun: false + readonly: + enabled: false +http: + addr: :5000 + headers: + X-Content-Type-Options: [nosniff] + Access-Control-Allow-Origin: ['http://127.0.0.1:8000'] + Access-Control-Allow-Credentials: [true] + Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS', 'DELETE'] + Access-Control-Allow-Headers: ['Authorization', 'Accept', 'Cache-Control'] + 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 +health: + storagedriver: + enabled: true + interval: 10s + threshold: 3 \ No newline at end of file