docker.recipes

FRP (Fast Reverse Proxy)

intermediate

Fast reverse proxy to expose local servers behind NAT or firewall to the internet

Overview

FRP (Fast Reverse Proxy) is a high-performance reverse proxy application designed to expose local servers behind NAT or firewalls to the internet through secure tunnels. Originally developed by fatedier, FRP has become a popular open-source alternative to commercial solutions like ngrok, offering both HTTP/HTTPS and TCP/UDP tunneling capabilities with minimal latency overhead. The project consists of two core components: frps (server) and frpc (client), which work together to establish secure connections between private networks and public servers. This Docker stack deploys the complete FRP infrastructure with frps running on a public server to accept incoming connections and route them through established tunnels to frpc clients running on private networks. The server component provides a web dashboard for monitoring active tunnels, connection statistics, and proxy configurations, while supporting multiple authentication methods and bandwidth limiting. The architecture enables bidirectional communication through NAT traversal without requiring port forwarding or firewall modifications on the client side. Developers working from home offices, system administrators managing remote servers, and organizations running services on private networks will find this stack invaluable for secure remote access. The combination offers enterprise-grade tunneling capabilities with fine-grained access controls, custom domain support, and the ability to handle thousands of concurrent connections while maintaining low resource overhead compared to VPN solutions.

Key Features

  • Multi-protocol tunnel support including HTTP, HTTPS, TCP, UDP, and STCP for diverse application requirements
  • Built-in web dashboard on port 7500 providing real-time monitoring of active proxies and bandwidth usage
  • Token-based authentication system preventing unauthorized tunnel establishment with configurable user permissions
  • Virtual host routing enabling multiple HTTP services to share port 80/443 through subdomain mapping
  • Bandwidth limiting and connection throttling to prevent abuse and manage resource consumption
  • Plugin system supporting authentication hooks, HTTPS certificate management, and custom request modification
  • Health check capabilities with automatic proxy restart on backend service failures
  • End-to-end encryption for all tunnel traffic with support for custom TLS certificates

Common Use Cases

  • 1Home lab administrators exposing local web services and APIs to the internet without public IP addresses
  • 2Remote development teams accessing staging servers and databases located behind corporate firewalls
  • 3IoT device manufacturers providing secure remote management interfaces for deployed hardware
  • 4Small businesses running internal applications that need occasional external access without VPN complexity
  • 5Game server hosting where players need direct TCP connections to servers on residential networks
  • 6Security researchers creating temporary public endpoints for webhook testing and API development
  • 7Freelance developers demonstrating client projects hosted on local development environments

Prerequisites

  • Public server with static IP address and minimum 512MB RAM for frps deployment
  • DNS records pointing to the public server for custom domain routing (A records for subdomains)
  • Open firewall ports 7000, 7500, 80, and 443 on the public server for tunnel and web traffic
  • Basic understanding of TOML configuration format for frps.toml and frpc.toml setup
  • Network connectivity between frpc clients and frps server on port 7000 for tunnel establishment
  • SSL certificates for HTTPS tunneling if using custom domains with encrypted traffic

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1# FRP Server (run on public server)
2services:
3 frps:
4 image: snowdreamtech/frps:latest
5 container_name: frps
6 restart: unless-stopped
7 ports:
8 - "${BIND_PORT:-7000}:7000"
9 - "${DASHBOARD_PORT:-7500}:7500"
10 - "${VHOST_HTTP_PORT:-80}:80"
11 - "${VHOST_HTTPS_PORT:-443}:443"
12 volumes:
13 - ./frps.toml:/etc/frp/frps.toml:ro
14 command: ["-c", "/etc/frp/frps.toml"]
15
16---
17# FRP Client (run on local machine) - separate docker-compose.yml
18# services:
19# frpc:
20# image: snowdreamtech/frpc:latest
21# container_name: frpc
22# restart: unless-stopped
23# volumes:
24# - ./frpc.toml:/etc/frp/frpc.toml:ro
25# command: ["-c", "/etc/frp/frpc.toml"]
26# network_mode: host # To access local services

.env Template

.env
1# FRP Server Configuration
2BIND_PORT=7000
3DASHBOARD_PORT=7500
4VHOST_HTTP_PORT=80
5VHOST_HTTPS_PORT=443
6
7# Create frps.toml:
8# bindPort = 7000
9# vhostHTTPPort = 80
10# vhostHTTPSPort = 443
11#
12# webServer.addr = "0.0.0.0"
13# webServer.port = 7500
14# webServer.user = "admin"
15# webServer.password = "admin"
16#
17# auth.method = "token"
18# auth.token = "your-secret-token"
19
20# Create frpc.toml (on client):
21# serverAddr = "your-server-ip"
22# serverPort = 7000
23# auth.token = "your-secret-token"
24#
25# [[proxies]]
26# name = "web"
27# type = "http"
28# localPort = 3000
29# customDomains = ["app.yourdomain.com"]

Usage Notes

  1. 1Server dashboard at http://server-ip:7500
  2. 2Create frps.toml config before starting server
  3. 3Create frpc.toml config for each client
  4. 4Use same auth.token on server and clients
  5. 5Supports HTTP, HTTPS, TCP, UDP, STCP tunnels
  6. 6Alternative to ngrok for self-hosted tunneling

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3# FRP Server (run on public server)
4services:
5 frps:
6 image: snowdreamtech/frps:latest
7 container_name: frps
8 restart: unless-stopped
9 ports:
10 - "${BIND_PORT:-7000}:7000"
11 - "${DASHBOARD_PORT:-7500}:7500"
12 - "${VHOST_HTTP_PORT:-80}:80"
13 - "${VHOST_HTTPS_PORT:-443}:443"
14 volumes:
15 - ./frps.toml:/etc/frp/frps.toml:ro
16 command: ["-c", "/etc/frp/frps.toml"]
17
18---
19# FRP Client (run on local machine) - separate docker-compose.yml
20# services:
21# frpc:
22# image: snowdreamtech/frpc:latest
23# container_name: frpc
24# restart: unless-stopped
25# volumes:
26# - ./frpc.toml:/etc/frp/frpc.toml:ro
27# command: ["-c", "/etc/frp/frpc.toml"]
28# network_mode: host # To access local services
29EOF
30
31# 2. Create the .env file
32cat > .env << 'EOF'
33# FRP Server Configuration
34BIND_PORT=7000
35DASHBOARD_PORT=7500
36VHOST_HTTP_PORT=80
37VHOST_HTTPS_PORT=443
38
39# Create frps.toml:
40# bindPort = 7000
41# vhostHTTPPort = 80
42# vhostHTTPSPort = 443
43#
44# webServer.addr = "0.0.0.0"
45# webServer.port = 7500
46# webServer.user = "admin"
47# webServer.password = "admin"
48#
49# auth.method = "token"
50# auth.token = "your-secret-token"
51
52# Create frpc.toml (on client):
53# serverAddr = "your-server-ip"
54# serverPort = 7000
55# auth.token = "your-secret-token"
56#
57# [[proxies]]
58# name = "web"
59# type = "http"
60# localPort = 3000
61# customDomains = ["app.yourdomain.com"]
62EOF
63
64# 3. Start the services
65docker compose up -d
66
67# 4. View logs
68docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/frp/run | bash

Troubleshooting

  • Connection refused on port 7000: Verify frps container is running and firewall allows incoming connections on the bind port
  • Dashboard not accessible on port 7500: Check if dashboard is enabled in frps.toml and DASHBOARD_PORT environment variable matches configuration
  • Tunnel established but HTTP requests fail: Ensure virtual host configuration matches the subdomain DNS records and backend service is accessible from frpc
  • Authentication failed errors: Verify auth.token matches exactly between frps.toml and frpc.toml configurations including any special characters
  • High memory usage on frps: Enable connection pooling and set max_connections limit in server configuration to prevent resource exhaustion
  • SSL certificate errors with HTTPS tunnels: Configure custom certificates in frps.toml or disable HTTPS verification for development environments

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space