TeamSpeak Server Setup - Based on Docker-Compose

Server Selection#

  • Tencent Cloud / Alibaba Cloud and other lightweight cloud servers
  • Prioritize student discounts and Hong Kong servers
  • Choose system image with pre-configured CentOS+Docker

Environment Configuration#

Make sure Docker and Docker-Compose are installed on the server

docker -v
docker-compose -v

If the version numbers are displayed correctly, you can skip the next step, otherwise you need to install them manually. Here is an example of installing them on CentOS 7:

Search for system name install docker compose to find many ready-made documents

# Install yum-utils
yum install -y yum-utils

# Configure yum repository
yum-config-manager --add-repo

# Install docker-ce
yum install -y docker-ce

# Set to start on boot
systemctl enable docker

# Start the service
systemctl start docker

# Install epel repository
yum install -y epel-release

# Install docker-compose, if python3 is not installed, it will be installed
yum install -y docker-compose

Configure TeamSpeak#

Find a suitable directory and create a new directory ts and navigate to it

Personally, I prefer to put all Docker configurations in the root directory /root/data/docker_data, but the specific location is not mandatory. However, each set of configurations should be placed in a separate folder.

mkdir -p /root/data/docker_data/ts3  # Create directory
cd /root/data/docker_data/ts3     # Switch to current directory

Create a new file docker-compose.yml, paste the following content and save. The file content is as follows (Official Image (opens new window)):

# docker-compose.yml

version: '3.1'
    image: teamspeak
    restart: always
      - 9987:9987/udp # Voice service
      - 30033:30033   # File transfer
      - 41144:41144   # DNS domain resolution (optional)
      - 10011:10011   # Server query raw (optional)
      # - 10022:10022   # Server query SSH (optional)
      # - 10080:10080   # Network request http (optional)
      # - 10443:10443   # Network request https (optional)
      - ./data:/var/ts3server
      TS3SERVER_DB_PLUGIN: ts3db_mariadb
      TS3SERVER_DB_SQLCREATEPATH: create_mariadb
      TS3SERVER_DB_USER: root
      TS3SERVER_DB_PASSWORD: password # Database password
      TS3SERVER_DB_NAME: teamspeak
      TS3SERVER_LICENSE: accept
    image: mariadb
    restart: always
      MYSQL_ROOT_PASSWORD: password  # Database password
      MYSQL_DATABASE: teamspeak
      - ./data/mysql:/var/lib/mysql  # Required, otherwise data will be lost after restarting the image

To edit the file on the server, use vi/vim/nano. If not available, use a similar command like yum install nano to install it on CentOS.

# [Create file]
vi docker-compose.yml
# or
vim docker-compose.yml
# or
nano docker-compose.yml

# [Paste] ctrl+v or ctrl+shift+v or shift+insert

# [Save] vi/vim: ESC :wq Enter

# [Save] nano: ctrl+x

Start the Service#

Make sure you are in the directory where docker-compose.yml is located, for example cd /data/ts:

# Start the service
docker-compose up

# Start the service and keep it running in the background
docker-compose up -d

# Stop the service
docker-compose down

# Restart the service
docker-compose restart

Connect to the server using the TS client, a dialog box will appear asking for a token. After entering the token, this account will become an administrator.

  • The first time you start, a Server Query Administrator Account Password and token will be displayed. Be sure to save them properly

  • If you start with docker-compose up -d for the first time, the relevant logs will be saved in ./data/logs

Open Rules#

Add the following inbound rules to the firewall settings page of the cloud server:

  • 9987 UDP
  • 30033 TCP
  • 41144 TCP
  • 10011 TCP

TS official port description (opens new window)

Domain Name Resolution#

  1. Add an A type rule pointing to the server's IP address. Here, ts -> resolves the domain name

  2. Add an SRV type rule, as shown in the image:

Domain Name Resolution


Client website:
Chinese translation pack:

Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.