Create a harbor mirror library through the command line

version below harbor 2.0

Create a harbor mirror library on the command line through an http request.
The following is the json file:
{"project_name": "google_containers","metadata": {"public": "true"}}
google_containers can be defined according to the name of the project you define.

To create a harbor mirror library,
first create a json file content, and then execute the following command.

curl -u "admin:Harbor12345" -X POST -H "Content-Type: application/json" "10.8.1.6:1121/api/projects" -d @createproject.json  

Harbor version 2.0 and above

Create a harbor mirror library through the command line

Common operations
\l #List all databases
\c dbname #Switch database
\d #List all tables of the current database
\q #Exit the database

1. First enter the db library of harbor

docker exec -it harbor-db bash 

2. Execute psql -w 输入数据库的密码, just press Enter in this step

3. Execute \lto query all libraries

4. Execute \c 加库名to enter the library

5. Enter the database to execute \dand list all the tables in the library

6. select * from 表名You can view all the data in the relevant tables. Generally, you can check whether the project has been successfully created by querying the project table.

The most critical step is to
create a harbor library project
. Create a kube_system project name. By analogy, you only need to modify the id and project name to create harbor library projects in turn. Add the
first common project name
and change the warehouse to common. Other unchanged

insert into project(project_id,owner_id,name) values('2','1','common');
insert into project_metadata(id,project_id,name,value) values('2','2','public','true');
insert into project_member(id,project_id,entity_id,entity_type,role) values('2','2','1','u','1');
insert into quota(id,reference,reference_id,hard) values('2','project','2','{"storage": -1}');
insert into quota_usage(id,reference,reference_id,used) values('2','project','2','{"storage": 0}');      

Add the second prod project name warehouse
and change it to prod, and the other ids are sequentially +1

insert into project(project_id,owner_id,name) values('3','1','prod');
insert into project_metadata(id,project_id,name,value) values('3','3','public','true');
insert into project_member(id,project_id,entity_id,entity_type,role) values('3','3','1','u','1');
insert into quota(id,reference,reference_id,hard) values('3','project','3','{"storage": -1}');
insert into quota_usage(id,reference,reference_id,used) values('3','project','3','{"storage": 0}');

Guess you like

Origin blog.csdn.net/weixin_45019350/article/details/125021305