Skip to content

Instantly share code, notes, and snippets.

@pigeon2049
Created November 28, 2024 08:01
Show Gist options
  • Save pigeon2049/b1b74041a9c825192cddc326b720e7e8 to your computer and use it in GitHub Desktop.
Save pigeon2049/b1b74041a9c825192cddc326b720e7e8 to your computer and use it in GitHub Desktop.
docker proxy
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
proxy:
remoteurl: http://registry-1.docker.io
name: docker-proxy
services:
registry:
image: registry:2
ports:
- '5000:5000'
volumes:
- ./config.yml:/etc/docker/registry/config.yml
- registry_data:/var/lib/registry
restart: always
container_name: registry
hostname: registry
logging:
driver: "json-file"
options:
max-size: "10m"
volumes:
registry_data:
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
ssl_certificate /path/to/cert.crt;
ssl_certificate_key /path/to/cert.key;
ssl_trusted_certificate /ssl/origin_ca_rsa_root.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ecdh_curve X25519:P-256:P-384:P-521;
ssl_early_data on;
ssl_stapling on;
ssl_stapling_verify off;
add_header Strict-Transport-Security "max-age=63072000" always;
server_name yourdomain;
location /v2/ {
# Allow GET, HEAD, OPTIONS requests
if ($request_method !~ ^(GET|HEAD|OPTIONS)$ ) {
return 405; # Method Not Allowed
}
# Proxy requests to the registry
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 80;
listen [::]:80;
server_name yourdomain;
return 301 https://yourdomain$request_uri;
}
official
docker pull yourdomain/library/postgres:12.22-bookworm
unofficial
docker pull yourdomain/redis/redis-stack-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment