본문으로 바로가기

[RHEL8] Harbor 구성방법 및 사용법

category Linux/RHEL7 & 8 2021. 11. 26. 16:39
반응형

Harbor Project 생성 및 docker image push (추가) 하는 방법을 정리하였습니다.

 

 

1. Harbor - Project 생성

project는 하나의 Repository 단위를 표현합니다.

Projects -> NEW Project를 선택한 후 Project 를 생성합니다.

 

 

아래와 같이 프로젝트가 생성됩니다.

 

 

해당 프로젝트에 들어가면 오른쪽에 "PUSH COMMAND" 라는 버튼이 있는데, 버튼을 선택하면 생성한 프로젝트에 image tag 방법과 push 방법에 대해 가이드해주며, Helm 및 CNAB 명령에 대해서는 가이드해줍니다.

 

 

 

2. Harbor - Repository 생성 및 Image Push

아래 두 방법을 가지고, 생성한 프로젝트에 이미지 Push하는 방법은 다음과 같습니다.

Tag an image for this project:

docker tag SOURCE_IMAGE[:TAG] 55.55.31.12:8080/hk-repo/REPOSITORY[:TAG]

Push an image to this project:
docker push 55.55.31.12:8080/hk-repo/REPOSITORY[:TAG]

 

현재 도커 이미지 정보를 확인합니다.

[root@rhocp-registry harbor]# docker images
REPOSITORY                      TAG       IMAGE ID       CREATED       SIZE
goharbor/harbor-exporter        v2.3.4    41f7fb260d0d   2 weeks ago   81.1MB
goharbor/chartmuseum-photon     v2.3.4    f460981da720   2 weeks ago   179MB
goharbor/redis-photon           v2.3.4    e4780c57b230   2 weeks ago   155MB
goharbor/trivy-adapter-photon   v2.3.4    af0652363af0   2 weeks ago   130MB
goharbor/notary-server-photon   v2.3.4    66c118fdbe3e   2 weeks ago   110MB
goharbor/notary-signer-photon   v2.3.4    27d49a4ae0d3   2 weeks ago   108MB
goharbor/harbor-registryctl     v2.3.4    0daeaba57fc6   2 weeks ago   133MB
goharbor/registry-photon        v2.3.4    8497f259228a   2 weeks ago   81.9MB
goharbor/nginx-photon           v2.3.4    2218fcda1ff0   2 weeks ago   45MB
goharbor/harbor-log             v2.3.4    4d507b2e8131   2 weeks ago   159MB
goharbor/harbor-jobservice      v2.3.4    5924b12f0b85   2 weeks ago   211MB
goharbor/harbor-core            v2.3.4    dc8b74f8c4f3   2 weeks ago   193MB
goharbor/harbor-portal          v2.3.4    770e6950323b   2 weeks ago   58.2MB
goharbor/harbor-db              v2.3.4    8e2ed50e4699   2 weeks ago   228MB
goharbor/prepare                v2.3.4    cce1a590410d   2 weeks ago   254MB

 

 

테스트를 위해 mariadb 이미지를 다운받습니다.

[root@rhocp-registry harbor]# docker pull mariadb
Using default tag: latest
latest: Pulling from library/mariadb
7b1a6ab2e44d: Pull complete
034655750c88: Pull complete
f0b757a2a0f0: Pull complete
4bbcce26bc5e: Pull complete
04f220ee9266: Pull complete
89c8a77f7842: Pull complete
d1de5652303b: Pull complete
ef669123e59e: Pull complete
e5cec468d3a6: Pull complete
b14b1ba1d651: Pull complete
Digest: sha256:0f04ae6f30c5a3295fb7cc9be5780c15ff21d6028f999b19f5803114c1e8559e
Status: Downloaded newer image for mariadb:latest
docker.io/library/mariadb:latest

 

 

도커 이미지 목록을 확인합니다.

[root@rhocp-registry harbor]# docker images
REPOSITORY                      TAG       IMAGE ID       CREATED       SIZE
mariadb                         latest    e2278f24ac88   2 weeks ago   410MB
goharbor/harbor-exporter        v2.3.4    41f7fb260d0d   2 weeks ago   81.1MB

 

 

프로젝트를 위한 image를 tag 설정을 합니다.

[root@rhocp-registry harbor]# docker tag mariadb:latest 55.55.31.12:8080/hk-repo/mariadb:latest

 

 

 harbor registry에 로그인 수행 한 후 image를 push 합니다.

[root@rhocp-registry harbor]# docker login https://55.55.31.12:8080
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
[root@rhocp-registry harbor]# docker push 55.55.31.12:8080/hk-repo/mariadb:latest
The push refers to repository [55.55.31.12:8080/hk-repo/mariadb]
c359e781d90a: Pushed
f95954e05332: Pushed
060b534c4abd: Pushed
672465781193: Pushed
6c649bbdd7d6: Pushed
286a90349ea9: Pushed
eb3b55e3972c: Pushed
8f2689356f7c: Pushed
657a7983a5d3: Pushed
9f54eef41275: Pushed
latest: digest: sha256:528cfe83d93caba437e75039b606a4637dd5c724c6a25d7c7b64ec2e9eb11303 size: 2412

 

생성한 프로젝트에 image push 되는 것을 확인할 수 있습니다.

 

 

728x90