Created
June 7, 2024 14:00
-
-
Save wangjiezhe/3549d45606dff121c8329db57067bcb5 to your computer and use it in GitHub Desktop.
Reverse proxy for Docker Hub using docker and caddy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 0.1 | |
log: | |
fields: | |
service: registry | |
storage: | |
cache: | |
blobdescriptor: inmemory | |
filesystem: | |
rootdirectory: /var/lib/registry | |
delete: | |
enabled: true | |
http: | |
addr: :5000 | |
headers: | |
X-Content-Type-Options: [nosniff] | |
health: | |
storagedriver: | |
enabled: true | |
interval: 10s | |
threshold: 3 | |
proxy: | |
remoteurl: https://registry-1.docker.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.8" | |
services: | |
registry-proxy: | |
image: registry | |
restart: unless-stopped | |
ports: | |
- 5000:5000 | |
volumes: | |
- ./data:/var/lib/registry | |
- ./config.yml:/etc/docker/registry/config.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dockerhub.domain.ltd { | |
# cert setting missing | |
header Docker-Distribution-Api-Version "registry/2.0" | |
handle /_ping { | |
reverse_proxy :5000 | |
} | |
handle /v2/_ping { | |
reverse_proxy :5000 | |
} | |
handle /v2/_catalog { | |
reverse_proxy :5000 | |
} | |
handle { | |
reverse_proxy :5000 { | |
transport http { | |
read_timeout 900s | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Docker Compose Dockerhub Service | |
Requires=docker.service | |
After=docker.service | |
[Service] | |
# Where the docker-compose file is located | |
WorkingDirectory=/srv/dockerhub | |
ExecStart=/usr/bin/docker compose up | |
ExecStop=/usr/bin/docker compose down | |
TimeoutStartSec=0 | |
Restart=on-failure | |
StartLimitBurst=3 | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment