This Docker image provides a simple way to deploy a Hysteria 2 (hy2) proxy server.
The image comes with a default configuration for the Hysteria 2 proxy:
listen: :33333
speedTest: true
tls:
cert: /etc/hysteria/default_certs/default.crt
key: /etc/hysteria/default_certs/default.key
sniGuard: disable
auth:
type: password
password: YourStrongPasswordHere
Important: You should change the default password for security reasons.
You can override the default configuration by mounting a /data volume and placing your custom /data/s.yaml configuration file inside it.
This image includes Certbot, allowing you to obtain SSL/TLS certificates from Let's Encrypt. If your domain is managed by Cloudflare, you can use the DNS challenge method for certificate issuance. This is particularly useful for SNI (Server Name Indication) verification, ensuring that TLS handshakes only succeed if the SNI matches your domain.
Cloudflare API Token: Create a Cloudflare API token with permissions to edit DNS records for your domain.
Cloudflare Credentials File: Create a cloudflare.ini file with your Cloudflare API token:
dns_cloudflare_api_token = YOUR_CLOUDFLARE_API_TOKEN
certbot certonly \
--config-dir /data/letsencrypt_config \
--work-dir /data/letsencrypt_config/work \
--logs-dir /data/letsencrypt_config/logs \
--dns-cloudflare \
--dns-cloudflare-credentials /data/cloudflare_secrets/cloudflare.ini \
--dns-cloudflare-propagation-seconds 30 \
-d <YOUR_DOMAIN> \
--agree-tos \
--email <YOUR_EMAIL> \
--no-eff-email
Replace <YOUR_DOMAIN> with your actual domain name and <YOUR_EMAIL> with your email address.
The obtained certificates will be stored in /data/letsencrypt_config/live/<YOUR_DOMAIN>/. You should then update your s.yaml to point to these certificate files:
tls:
cert: /data/letsencrypt_config/live/<YOUR_DOMAIN>/fullchain.pem
key: /data/letsencrypt_config/live/<YOUR_DOMAIN>/privkey.pem
sniGuard: strict # Enable SNI guard if desired
You can test the certificate renewal process (without actually renewing) using:
certbot renew \
--config-dir /data/letsencrypt_config \
--work-dir /data/letsencrypt_config/work \
--logs-dir /data/letsencrypt_config/logs \
--dry-run
To set up automatic renewal, you can create a cron job on your host system or within the container to run the certbot renew command periodically.
Feel free to open issues or submit pull requests if you have suggestions or improvements.
Content type
Image
Digest
sha256:5d231273c…
Size
37.4 MB
Last updated
over 1 year ago
docker pull fontlos/hysteria2