Docker의 개인 1.0 레지스트리에서 이미지를 검색하는 방법은 무엇입니까?
개인 레지스트리를 만들었습니다 .curl xx.xx.xx.xx : 5000은 괜찮습니다. 다음을 수행하여 이미지를 도커 개인 레지스트리로 푸시합니다 docker push xx.xx.xx.xx:5000/centos
.
http://xx.xx.xx.xx:5000/v1/repositories/centos/tags/latest
문제는 레지스트리 웹에서 모든 이미지를 가져 오거나 무엇이든 명령하는 방법입니다. 도커 레지스트리 API에서 정보를 찾을 수 없습니다. 아무도 도와 주나요? :)
개인 레지스트리 v 0.7.0부터 다음을 수행 할 수 있습니다.
$ curl -X GET http://localhost:5000/v1/search?q=postgresql
그리고 json 페이로드를 얻을 것입니다.
{"num_results": 1, "query": "postgresql", "results": [{"description": "", "name": "library/postgresql"}]}
여기에 더 많은 배경 정보를 제공하기 위해 레지스트리를 시작한 방법이 있습니다.
docker run \
-e SETTINGS_FLAVOR=local \
-e STORAGE_PATH=/registry \
-e SEARCH_BACKEND=sqlalchemy \
-e LOGLEVEL=DEBUG \
-p 5000:5000 \
registry
이제 Docker 클라이언트에서 HTTP API 또는 추가 도구를 사용하지 않고 개인 레지스트리를 직접 검색 할 수 있습니다.
예 : centos 이미지 검색 :
docker search localhost:5000/centos
그래서 이것이 빠르게 변화하는 분야라는 것을 알고 있지만 (2015-09-08 기준) Docker Registry HTTP API V2 에서 다음을 발견했습니다 .
저장소 나열 ( 링크 )
GET /v2/_catalog
이미지 태그 나열 ( 링크 )
GET /v2/<name>/tags/list
이를 기반으로 다음은 로컬 레지스트리에서 나를 위해 일했습니다 (레지스트리 : 2 이미지 ID 1e847b14150e365a95d76a9cc6b71cd67ca89905e3a0400fa44381ecf00890e1 2015-08-25T07 : 55 : 17.072에 생성됨).
$ curl -X GET http://localhost:5000/v2/_catalog
{"repositories":["ubuntu"]}
$ curl -X GET http://localhost:5000/v2/ubuntu/tags/list
{"name":"ubuntu","tags":["latest"]}
현재 Docker Registry v2에 대한 검색 지원은 없습니다 .
주제에 대한 장기 실행 스레드가 있습니다. 현재 계획은 v2.1에서 준비 해야하는 확장 기능 을 사용하여 검색을 지원하는 것 입니다.
A와 해결 방법 , 당신의 레지스트리 V2가 실행중인 시스템에서 다음을 실행합니다 :
> docker exec -it <your_registry_container_id> bash
> ls /var/lib/registry/docker/registry/v2/repositories/
이미지는 네임 스페이스에 해당하는 하위 디렉토리에 있습니다. 예 : jwilder/nginx-proxy
'라이브러리'만 검색하여 개인 레지스트리의 모든 것을 다시 가져올 수있었습니다.
docker search [my.registry.host]:[port]/library
반환 (예) :
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
library/custom-image 0
library/another-image 0
library/hello-world 0
UI를 제공하고 개인 레지스트리를 검색하는 atc- / docker-registry-web 프로젝트를 설치했습니다. https://github.com/atc-/docker-registry-web
고정되어 있으며 다음으로 실행할 수 있습니다.
docker run -p 8080 : 8080 -e REG1 = http : //registry_host.name : 5000 / v1 / atcol / docker-registry-ui
찾아보고 내용을 검토하십시오. registry_ui_host.name:8080
모든 이미지 나열
docker search <registry_host>:<registry_port>/
'vcs'와 같은 이미지 나열
docker search <registry_host>:<registry_port>/vcs
현재 AFAIK는 개인 레지스트리에없는 색인으로이 정보를 저장해야하므로이를 수행하는 쉬운 방법이 없습니다. 그러나 레지스트리를 시작한 방법에 따라 두 가지 옵션이 있습니다.
- if you started registry without -v to store data in separate host folder you can try with
docker diff <id_of_registry_container>
with this you should get info about changes in container fs. All pushed images should be somewhere in /tmp/registry/repositories/ - if you started registry with -v just check content of mounted directory on host
If you used "centos" as name it should be in /tmp/registry/repositories/library/centos. This folder will contain text files which describes image structure. Actual data is in /tmp/registry/images/.
Modifying the answer from @mre to get the list just from one command (valid at least for Docker Registry v2).
docker exec -it <your_registry_container_id> ls -a /var/lib/registry/docker/registry/v2/repositories/
Another method in one line (substitute your actual path/ports if needed).
Example: Assume a generic registry:2.0 start up, the running registry container has a log file that holds images and tag names. I extrapolate the data like this:
grep -r -o "vars\.name=.* vars.reference=.*" /var/lib/docker/containers/* | cut -c 167-225 | sed 's/ver.*$//' | sed 's/vars\.name=//' | sed 's/ vars\.reference=/:/' | sort -u
You may need to tweak the cut values to get the output desired.
'Program Tip' 카테고리의 다른 글
.htaccess를 사용하여 HTTP를 HTTP로 리디렉션 (0) | 2020.10.22 |
---|---|
MVC 면도기 @foreach (0) | 2020.10.22 |
ExecutorService를 통해 CompletionService를 언제 사용해야합니까? (0) | 2020.10.22 |
이 정규식에 음수 십진수를 어떻게 포함합니까? (0) | 2020.10.22 |
다른 것없이 루비 삼항 연산자 (0) | 2020.10.22 |