/docker-matrix-turn

A STUN/TURN server, optimized for setup with Matrix home servers

Primary LanguageDockerfileApache License 2.0Apache-2.0

matrix-turn

A STUN/TURN server, optimized for setup with Matrix home servers. Uses an env-based config.

NOTE: We're using the external 'host' network instead of publishing ports. This is required to work around the no-NAT requirement for coturn, even though it destroys network isolation for the container.

docker run

docker run -it --rm \
    --name coturn \
    -e SHARED_SECRET=mysecret \
    -e REALM=turn.example.com \
    --net=host \
    johnstarich/matrix-turn:2.0.0

docker stack

version: "3.4"

services:
  coturn:
    image: johnstarich/matrix-turn:2.0.0
    environment:
    - SHARED_SECRET=mysecret
    - REALM=turn.example.com
    # Optional:
    #- INTERNAL_IP=
    #- EXTERNAL_IP=
    #
    # NOTE: We're using the external 'host' network instead of publishing ports.
    # This is required to work around the no-NAT requirement for coturn, even though it destroys network isolation for this container.
    networks:
    - host

networks:
  host:
    external: true

Environment variables

These environment variables are required:

  • SHARED_SECRET - turn_shared_secret: in Matrix config
  • REALM - public hostname for the TURN server, turn_uris: in Matrix config
    • Example Matrix config line: turn_uris: ["turn:turn.example.com?transport=udp", "turn:turn.example.com?transport=tcp"]

If you need to do some debugging, add -e COTURN_verbose= (blank value) as well.

See coturn for all available config values, then set them as environment variables with COTURN_ prefixes.

coturn license

See coturn's license for more info.