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 -it --rm \
--name coturn \
-e SHARED_SECRET=mysecret \
-e REALM=turn.example.com \
--net=host \
johnstarich/matrix-turn:2.0.0
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
These environment variables are required:
SHARED_SECRET
-turn_shared_secret:
in Matrix configREALM
- 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"]
- Example Matrix config line:
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.
See coturn's license for more info.