整的使用 Docker Compose 部署 frp 的示例配置文件

By | 2024-09-17

MarkDown整的使用 Docker Compose 部署 frp 的示例配置文件:

yaml

Copy code

version: ‘3’

networks:
default:
external: true
name: host

services:

frps:
image: snowdreamtech/frps
restart: always
network_mode: host
volumes:

  - type: volume 
    source: frps_config
    target: /etc/frp/frps.ini
    volume:
      nocopy: true
      content: |
        [common]
        bind_port = 7000
        dashboard_port = 7500
        dashboard_user = admin
        dashboard_pwd = 1234
        token = abc123

frpc:
image: snowdreamtech/frpc
restart: always
network_mode: host
volumes:

  - type: volume
    source: frpc_config
    target: /etc/frp/frpc.ini
    volume: 
      nocopy: true
      content: |
        [common]
        server_addr = your_ip
        server_port = 7000

        [ssh]
        type = tcp
        local_ip = 127.0.0.1
        local_port = 22
        remote_port = 6000

这个 compose 文件定义了:

使用 host 网络模式
frps 和 frpc 服务分别从镜像启动
配置文件内容直接在 compose 中定义,不需要本地文件
可以通过 docker-compose up -d 来启动这两个服务。

这样就可以完全通过 docker-compose 来管理 frp 部署了。