---
# System prepended metadata

title: 安裝 SUSE Registry
tags: [系統工程]

---

# Podman 安裝 SUSE Private Registry
* podman 版本需要在 4.7 版之後
```
$ sudo podman version
[sudo] password for root:
Client:       Podman Engine
Version:      4.8.3
API Version:  4.8.3
Go Version:   go1.21.5
Built:        Thu Jan  4 20:00:00 2024
OS/Arch:      linux/amd64
```
* 建立 image 永存目錄區
```
$ sudo mkdir /opt/registry

$ sudo chown $(id -u):$(id -g) /opt/registry
```
* 使用 podman rootless 安裝 suse registry
```
$ podman run -d -p 5000:5000 \
--uidmap "+499:@$(id -u):1" \
--gidmap "+486:@$(id -g):1" \
-v /opt/registry:/var/lib/docker-registry \
--name registry \
registry.suse.com/suse/registry:2.8
```
* 測試是否可以上傳 image
```
$ podman pull nginx

$ podman tag nginx 192.168.11.111:5000/nginx

$ podman push --tls-verify=false 192.168.11.111:5000/nginx
```
* 使用 api 方式查看 image 清單
```
$  curl -XGET http://192.168.11.111:5000/v2/_catalog
{"repositories":["nginx"]}
```
* 檢查 podman host，image 永存目錄區
```
$ sudo ls -l /opt/registry/docker/registry/v2/repositories/
total 0
drwxr-xr-x 1 rancher users 50 Mar 22 11:23 nginx
```
