Create registry-proxy
This commit is contained in:
parent
85dc33dfba
commit
33b6d7d677
|
@ -0,0 +1,7 @@
|
||||||
|
FROM registry:latest
|
||||||
|
LABEL maintainer="Stille <stille@ioiox.com>"
|
||||||
|
|
||||||
|
ENV PROXY_REMOTE_URL="" \
|
||||||
|
DELETE_ENABLED=""
|
||||||
|
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
|
@ -0,0 +1,32 @@
|
||||||
|
# mc
|
||||||
|
|
||||||
|
GitHub [stilleshan/dockerfiles](https://github.com/stilleshan/dockerfiles)
|
||||||
|
Docker [stilleshan/registry-proxy](https://hub.docker.com/r/stilleshan/registry-proxy)
|
||||||
|
> *docker image support for X86 and ARM*
|
||||||
|
|
||||||
|
## 简介
|
||||||
|
代理 ghcr.io / gcr.io / k8s.gcr.io 等镜像仓库的 registry proxy 镜像.
|
||||||
|
|
||||||
|
## 使用
|
||||||
|
### docker
|
||||||
|
环境变量`PROXY_REMOTE_URL`:
|
||||||
|
- https://ghcr.io
|
||||||
|
- https://gcr.io
|
||||||
|
- https://k8s.gcr.io
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker run -d --restart always \
|
||||||
|
-v /data/path:/var/lib/registry\
|
||||||
|
-p 5000:5000 \
|
||||||
|
-e PROXY_REMOTE_URL=https://ghcr.io \
|
||||||
|
stilleshan/registry-proxy
|
||||||
|
```
|
||||||
|
|
||||||
|
### docker compose
|
||||||
|
下载 [docker-compose.yml](https://raw.githubusercontent.com/stilleshan/dockerfiles/main/registry-proxy/docker-compose.yml) 执行以下命令启动:
|
||||||
|
```shell
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
## 参考
|
||||||
|
- GitHub [findsec-cn/registry-proxy](https://github.com/findsec-cn/registry-proxy)
|
|
@ -0,0 +1,12 @@
|
||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
ghcr.io:
|
||||||
|
image: stilleshan/registry-proxy
|
||||||
|
volumes:
|
||||||
|
- ./data:/var/lib/registry
|
||||||
|
- /etc/localtime:/etc/localtime
|
||||||
|
ports:
|
||||||
|
- 5000:5000
|
||||||
|
environment:
|
||||||
|
- PROXY_REMOTE_URL=https://ghcr.io
|
||||||
|
restart: always
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CONFIG_YML=/etc/docker/registry/config.yml
|
||||||
|
|
||||||
|
if [ -n "$PROXY_REMOTE_URL" -a `grep -c "$PROXY_REMOTE_URL" $CONFIG_YML` -eq 0 ]; then
|
||||||
|
echo "proxy:" >> $CONFIG_YML
|
||||||
|
echo " remoteurl: $PROXY_REMOTE_URL" >> $CONFIG_YML
|
||||||
|
echo "------ Enabled proxy to remote: $PROXY_REMOTE_URL ------"
|
||||||
|
elif [ $DELETE_ENABLED = true -a `grep -c "delete:" $CONFIG_YML` -eq 0 ]; then
|
||||||
|
sed -i '/rootdirectory/a\ delete:' $CONFIG_YML
|
||||||
|
sed -i '/delete/a\ enabled: true' $CONFIG_YML
|
||||||
|
echo "------ Enabled local storage delete -----"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
*.yaml|*.yml) set -- registry serve "$@" ;;
|
||||||
|
serve|garbage-collect|help|-*) set -- registry "$@" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exec "$@"
|
Loading…
Reference in New Issue