---
# System prepended metadata

title: Docker Registry
tags: [DevOps, III]

---

Docker Registry
===

###### tags: `III` `DevOps`

## Web UI
http://docker5gc:8080/
http://docker5gc.nmsi.pri:8080/
http://10.22.100.108:8080/

## Installation
### Docker Registry Server
Storage - [Linux LVM (建立、擴充、移除LVM磁區) 操作筆記](https://sc8log.blogspot.com/2017/03/linux-lvm-lvm.html)
```
docker run -d \
  -p 5000:5000 \
  --restart=always \
  --name registry-srv \
  -v /dockerhub-storage:/var/lib/registry \
  -e REGISTRY_STORAGE_DELETE_ENABLED=true \
  registry:2
```
### Docker Registry Web
```
docker run -it -p 8080:8080 -d --restart=always --name registry-web --link registry-srv -e REGISTRY_URL=http://docker5gc:5000/v2 -e REGISTRY_NAME=docker5gc:5000 hyper/docker-registry-web
```

## Client Setting
加 /etc/docker/daemon.json
```
{
  "live-restore": true,
  "group": "docker",
  "insecure-registries": ["docker5gc:5000"]
}
```
重啟
```
systemctl restart docker
```
確認
```
docker info
```
![](https://i.imgur.com/txqUtjL.png)

## Delete Images
```
curl -v --silent -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X GET http://docker5gc:5000/v2/<repos>/manifests/<tag> 2>&1 | grep Docker-Content-Digest | awk '{print ($3)}'
```
```
curl -X DELETE docker5gc:5000/v2/cpprest/manifests/<sha256:e4daa0979c86fe71d2be77676d47cdc4c2e30f6256d99a14ee16878a3c7ef088>
```
進入 registry container
```
bin/registry garbage-collect /etc/docker/registry/config.yml
```