{"id":22109198,"url":"https://github.com/psvmcc/static_docker_v2_registry","last_synced_at":"2026-04-16T10:36:26.247Z","repository":{"id":93987451,"uuid":"237791485","full_name":"psvmcc/static_docker_v2_registry","owner":"psvmcc","description":"PoC static docker v2 registry using Ansible, Skopeo and Nginx with NJS module.","archived":false,"fork":false,"pushed_at":"2020-02-02T19:13:37.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T03:47:43.196Z","etag":null,"topics":["ansible","automation","container-registry","containers","docker","docker-registry-v2","nginx","njs","registry","registry-hacks","secure","skopeo","static-registry"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/psvmcc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-02T15:26:04.000Z","updated_at":"2023-04-21T06:10:15.000Z","dependencies_parsed_at":"2023-03-19T02:06:04.261Z","dependency_job_id":null,"html_url":"https://github.com/psvmcc/static_docker_v2_registry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/psvmcc/static_docker_v2_registry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psvmcc%2Fstatic_docker_v2_registry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psvmcc%2Fstatic_docker_v2_registry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psvmcc%2Fstatic_docker_v2_registry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psvmcc%2Fstatic_docker_v2_registry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psvmcc","download_url":"https://codeload.github.com/psvmcc/static_docker_v2_registry/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psvmcc%2Fstatic_docker_v2_registry/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31882797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T09:23:21.276Z","status":"ssl_error","status_checked_at":"2026-04-16T09:23:15.028Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","automation","container-registry","containers","docker","docker-registry-v2","nginx","njs","registry","registry-hacks","secure","skopeo","static-registry"],"created_at":"2024-12-01T09:29:36.332Z","updated_at":"2026-04-16T10:36:26.222Z","avatar_url":"https://github.com/psvmcc.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## static docker v2 registry generator\n\n## Requirements\n\nTested on CentOS 7 with following software:\n\n* ansible=2.9.2\n* [skopeo](https://github.com/containers/skopeo)=0.1.37\n* nginx=1.16.1\n* nginx-module-njs=1.16.1\n\n## Configuration\n1. Copy `nginx/script.njs` \u0026 `nginx/server.conf` into `/etc/nginx/`.\n2. Load NJS module in `nginx.conf`: `load_module modules/ngx_http_js_module.so;`.\n3. Include `server.conf` in `nginx.conf` file: `include server.conf;`.\n4. Test nginx configuration `nginx -t` and reload `nginx -s reload`.\n\nFor SSL termination I have used CloudFlare.\n\n## Generate artifacts with ansible playbook\nTo add a new container/tag or to update an existing container just edit the _inventory.yaml_ file.\n\n```sh\n# ansible-playbook -i inventory.yaml generate.yaml\n\nPLAY [localhost] **********************************************************************\n\nTASK [Check if tags is not float] *****************************************************\nSunday 02 February 2020  14:57:10 +0000 (0:00:00.034)       0:00:00.034 *******\nok: [localhost] =\u003e {\n    \"changed\": false,\n    \"msg\": \"All assertions passed\"\n}\n\nTASK [Create a directory for export] **************************************************\nSunday 02 February 2020  14:57:10 +0000 (0:00:00.062)       0:00:00.096 *******\nchanged: [localhost] =\u003e (item=/home/artifacts/docker_images/nginx)\nchanged: [localhost] =\u003e (item=/home/artifacts/docker_images/prom/prometheus)\nchanged: [localhost] =\u003e (item=/home/artifacts/docker_images/prom/node-exporter)\nchanged: [localhost] =\u003e (item=/home/artifacts/docker_images/prom/alertmanager)\nchanged: [localhost] =\u003e (item=/home/artifacts/docker_images/k8s_gcr_io/pause)\nchanged: [localhost] =\u003e (item=/home/artifacts/docker_images/coredns/coredns)\nchanged: [localhost] =\u003e (item=/home/artifacts/docker_images/quay_io/coreos/flannel)\n\nTASK [Create directory for registry structure] ****************************************\nSunday 02 February 2020  14:57:12 +0000 (0:00:01.570)       0:00:01.666 *******\nchanged: [localhost] =\u003e (item=/home/artifacts/v2/blobs)\nchanged: [localhost] =\u003e (item=/home/artifacts/v2/manifests)\nchanged: [localhost] =\u003e (item=/home/artifacts/v2/tags)\n\nTASK [Archive image of interest into local directory] *********************************\nSunday 02 February 2020  14:57:12 +0000 (0:00:00.559)       0:00:02.226 *******\nchanged: [localhost] =\u003e (item=nginx:1.16.1-alpine)\nchanged: [localhost] =\u003e (item=nginx:alpine)\nchanged: [localhost] =\u003e (item=prom/prometheus:v2.15.2)\nchanged: [localhost] =\u003e (item=prom/node-exporter:v0.18.1)\nchanged: [localhost] =\u003e (item=prom/alertmanager:v0.20.0)\nchanged: [localhost] =\u003e (item=k8s.gcr.io/pause:3.1)\nchanged: [localhost] =\u003e (item=k8s.gcr.io/pause:3.0)\nchanged: [localhost] =\u003e (item=coredns/coredns:1.6.6)\nchanged: [localhost] =\u003e (item=quay.io/coreos/flannel:v0.11.0)\n\nTASK [Hardlink image blobs] ***********************************************************\nSunday 02 February 2020  14:57:36 +0000 (0:00:23.506)       0:00:25.733 *******\nok: [localhost] =\u003e (item=nginx:1.16.1-alpine)\nok: [localhost] =\u003e (item=nginx:alpine)\nok: [localhost] =\u003e (item=prom/prometheus:v2.15.2)\nok: [localhost] =\u003e (item=prom/node-exporter:v0.18.1)\nok: [localhost] =\u003e (item=prom/alertmanager:v0.20.0)\nok: [localhost] =\u003e (item=k8s.gcr.io/pause:3.1)\nok: [localhost] =\u003e (item=k8s.gcr.io/pause:3.0)\nok: [localhost] =\u003e (item=coredns/coredns:1.6.6)\nok: [localhost] =\u003e (item=quay.io/coreos/flannel:v0.11.0)\n\nTASK [Get manifest digest] ************************************************************\nSunday 02 February 2020  14:57:38 +0000 (0:00:01.634)       0:00:27.367 *******\nok: [localhost] =\u003e (item=nginx:1.16.1-alpine)\nok: [localhost] =\u003e (item=nginx:alpine)\nok: [localhost] =\u003e (item=prom/prometheus:v2.15.2)\nok: [localhost] =\u003e (item=prom/node-exporter:v0.18.1)\nok: [localhost] =\u003e (item=prom/alertmanager:v0.20.0)\nok: [localhost] =\u003e (item=k8s.gcr.io/pause:3.1)\nok: [localhost] =\u003e (item=k8s.gcr.io/pause:3.0)\nok: [localhost] =\u003e (item=coredns/coredns:1.6.6)\nok: [localhost] =\u003e (item=quay.io/coreos/flannel:v0.11.0)\n\nTASK [Generate docker images hash map] ************************************************\nSunday 02 February 2020  14:57:39 +0000 (0:00:01.668)       0:00:29.036 *******\nok: [localhost] =\u003e (item=nginx:1.16.1-alpine)\nok: [localhost] =\u003e (item=nginx:alpine)\nok: [localhost] =\u003e (item=prom/prometheus:v2.15.2)\nok: [localhost] =\u003e (item=prom/node-exporter:v0.18.1)\nok: [localhost] =\u003e (item=prom/alertmanager:v0.20.0)\nok: [localhost] =\u003e (item=k8s.gcr.io/pause:3.1)\nok: [localhost] =\u003e (item=k8s.gcr.io/pause:3.0)\nok: [localhost] =\u003e (item=coredns/coredns:1.6.6)\nok: [localhost] =\u003e (item=quay.io/coreos/flannel:v0.11.0)\n\nTASK [Hardlink manifest files] ********************************************************\nSunday 02 February 2020  14:57:39 +0000 (0:00:00.232)       0:00:29.268 *******\nchanged: [localhost] =\u003e (item=nginx:1.16.1-alpine)\nchanged: [localhost] =\u003e (item=nginx:alpine)\nchanged: [localhost] =\u003e (item=prom/prometheus:v2.15.2)\nchanged: [localhost] =\u003e (item=prom/node-exporter:v0.18.1)\nchanged: [localhost] =\u003e (item=prom/alertmanager:v0.20.0)\nchanged: [localhost] =\u003e (item=k8s.gcr.io/pause:3.1)\nchanged: [localhost] =\u003e (item=k8s.gcr.io/pause:3.0)\nchanged: [localhost] =\u003e (item=coredns/coredns:1.6.6)\nchanged: [localhost] =\u003e (item=quay.io/coreos/flannel:v0.11.0)\n\nTASK [Generate tags] ******************************************************************\nSunday 02 February 2020  14:57:41 +0000 (0:00:01.641)       0:00:30.910 *******\nchanged: [localhost] =\u003e (item=nginx)\nchanged: [localhost] =\u003e (item=prom/prometheus)\nchanged: [localhost] =\u003e (item=prom/node-exporter)\nchanged: [localhost] =\u003e (item=prom/alertmanager)\nchanged: [localhost] =\u003e (item=k8s.gcr.io/pause)\nchanged: [localhost] =\u003e (item=coredns/coredns)\nchanged: [localhost] =\u003e (item=quay.io/coreos/flannel)\n\nTASK [Create db file] *****************************************************************\nSunday 02 February 2020  14:57:43 +0000 (0:00:02.410)       0:00:33.320 *******\nchanged: [localhost]\n\nPLAY RECAP ****************************************************************************\nlocalhost                  : ok=10   changed=6    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0\n\nSunday 02 February 2020  14:57:44 +0000 (0:00:00.318)       0:00:33.639 *******\n===============================================================================\nArchive image of interest into local directory -------------------------------- 23.51s\nGenerate tags ------------------------------------------------------------------ 2.41s\nGet manifest digest ------------------------------------------------------------ 1.67s\nHardlink manifest files -------------------------------------------------------- 1.64s\nHardlink image blobs ----------------------------------------------------------- 1.63s\nCreate a directory for export -------------------------------------------------- 1.57s\nCreate directory for registry structure ---------------------------------------- 0.56s\nCreate db file ----------------------------------------------------------------- 0.32s\nGenerate docker images hash map ------------------------------------------------ 0.23s\nCheck if tags is not float ----------------------------------------------------- 0.06s\n```\n\n## Testing\n\nNow we can pull image from our repo:\n```sh\n$ docker pull my.domain.net/k8s.gcr.io/pause:3.1\n3.1: Pulling from k8s.gcr.io/pause\n67ddbfb20a22: Pull complete\nDigest: sha256:59eec8837a4d942cc19a52b8c09ea75121acc38114a2c68b98983ce9356b8610\nStatus: Downloaded newer image for my.domain.net/k8s.gcr.io/pause:3.1\nmy.domain.net/k8s.gcr.io/pause:3.1\n\n$ docker images\nREPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE\nmy.domain.net/k8s.gcr.io/pause   3.1                 da86e6ba6ca1        2 years ago         742kB\n```\n\nFrom Nginx side we can see next logs:\n```\n[02/Feb/2020:15:02:11 +0000] \"GET /v2/ HTTP/1.1\" 200 2 \"-\" \"docker/19.03.5\"\n[02/Feb/2020:15:02:11 +0000] \"GET /v2/k8s.gcr.io/pause/manifests/3.1 HTTP/1.1\" 200 527 \"-\" \"docker/19.03.5\"\n[02/Feb/2020:15:02:12 +0000] \"GET /v2/k8s.gcr.io/pause/blobs/sha256:da86e6ba6ca197bf6bc5e9d900febd906b133eaa4750e6bed647b0fbe50ed43e HTTP/1.1\" 200 1609 \"-\" \"docker/19.03.5\"\n[02/Feb/2020:15:02:12 +0000] \"GET /v2/k8s.gcr.io/pause/blobs/sha256:67ddbfb20a22d7c0ea0df568069e7ffc42378467402d04f28ecfa244e78c5eb8 HTTP/1.1\" 200 313363 \"-\" \"docker/19.03.5\"\n```\n\nLet's try pull original image:\n```sh\n$ docker pull k8s.gcr.io/pause:3.1\n3.1: Pulling from pause\nDigest: sha256:f78411e19d84a252e53bff71a4407a5686c46983a2c2eeed83929b888179acea\nStatus: Downloaded newer image for k8s.gcr.io/pause:3.1\nk8s.gcr.io/pause:3.1\n\n$ docker images\nREPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE\nk8s.gcr.io/pause                3.1                 da86e6ba6ca1        2 years ago         742kB\nmy.domain.net/k8s.gcr.io/pause   3.1                 da86e6ba6ca1        2 years ago         742kB\n```\nAs you can see, it not pull any blobs, and `IMAGE ID` the same. Let's try to inspect repos with `skopeo` tool:\n\n```sh\n$ skopeo inspect docker://my.domain.net/k8s.gcr.io/pause:3.1\n{\n    \"Name\": \"my.domain.net/k8s.gcr.io/pause\",\n    \"Digest\": \"sha256:59eec8837a4d942cc19a52b8c09ea75121acc38114a2c68b98983ce9356b8610\",\n    \"RepoTags\": [\n        \"3.1\",\n        \"3.0\"\n    ],\n    \"Created\": \"2017-12-20T21:30:49.042210931Z\",\n    \"DockerVersion\": \"1.12.6\",\n    \"Labels\": {},\n    \"Architecture\": \"amd64\",\n    \"Os\": \"linux\",\n    \"Layers\": [\n        \"sha256:67ddbfb20a22d7c0ea0df568069e7ffc42378467402d04f28ecfa244e78c5eb8\"\n    ]\n}\n$ skopeo inspect docker://k8s.gcr.io/pause:3.1\n{\n    \"Name\": \"k8s.gcr.io/pause\",\n    \"Digest\": \"sha256:f78411e19d84a252e53bff71a4407a5686c46983a2c2eeed83929b888179acea\",\n    \"RepoTags\": [\n        \"0.8.0\",\n        \"1.0\",\n        \"2.0\",\n        \"3.0\",\n        \"3.1\",\n        \"go\",\n        \"latest\",\n        \"test\",\n        \"test2\"\n    ],\n    \"Created\": \"2017-12-20T21:30:49.042210931Z\",\n    \"DockerVersion\": \"1.12.6\",\n    \"Labels\": {},\n    \"Architecture\": \"amd64\",\n    \"Os\": \"linux\",\n    \"Layers\": [\n        \"sha256:67ddbfb20a22d7c0ea0df568069e7ffc42378467402d04f28ecfa244e78c5eb8\"\n    ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsvmcc%2Fstatic_docker_v2_registry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsvmcc%2Fstatic_docker_v2_registry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsvmcc%2Fstatic_docker_v2_registry/lists"}