還沒安裝的可以看上一篇:
使用 Harbor 建立 Docker 私有儲存庫(Docker Registry) 安裝示範
進行安裝。
筆者安裝完成使用後發現在 Harbor 網頁上建立完專案後居然無法修改專案名稱!
研究了一番後發現 Harbor 在介面上無法直接修改專案名稱,真的要修改的話需要進入資料庫中修改。
進入 Harbor 的 PostgreSQL 容器:
查看所有資料庫:
範例輸出:
切換到 registry 資料庫:
查詢所有專案:
範例輸出:
假設要將 my-project 改名為 new-project :
再次查詢:
修改成功!
筆者安裝完成使用後發現在 Harbor 網頁上建立完專案後居然無法修改專案名稱!
研究了一番後發現 Harbor 在介面上無法直接修改專案名稱,真的要修改的話需要進入資料庫中修改。
進入 Harbor 的 PostgreSQL 容器:
docker exec -it harbor-db psql -U postgres
查看所有資料庫:
\l
範例輸出:
\l
List of databases
Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges
-----------+----------+----------+-------------+-------------+------------+-----------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc |
registry | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
(4 rows)
切換到 registry 資料庫:
\c registry
查詢所有專案:
select * from project;
範例輸出:
select * from project;
project_id | owner_id | name | creation_time | update_time | deleted | registry_id
------------+----------+------------+----------------------------+----------------------------+---------+-------------
1 | 1 | library | 2024-11-28 16:12:27.70749 | 2024-11-28 16:12:27.70749 | f |
2 | 3 | my-project | 2024-12-06 17:34:40.305839 | 2024-12-06 17:34:40.305839 | f | 0
(2 rows)
假設要將 my-project 改名為 new-project :
UPDATE project SET name = 'new-project' WHERE name = 'my-project';
再次查詢:
select * from project;
project_id | owner_id | name | creation_time | update_time | deleted | registry_id
------------+----------+-------------+----------------------------+----------------------------+---------+-------------
1 | 1 | library | 2024-11-28 16:12:27.70749 | 2024-11-28 16:12:27.70749 | f |
2 | 3 | new-project | 2024-12-06 17:34:40.305839 | 2024-12-08 17:01:25.113403 | f | 0
(2 rows)
修改成功!
留言
張貼留言
如果有任何問題、建議、想說的話或文章題目推薦,都歡迎留言或來信: a@ruyut.com