1. Home
  2. Linux
  3. How to host a teamspeak server in docker

How to host a TeamSpeak server in Docker

TeamSpeak is a great option for those who want to host their voice communication channels, rather than rely on something like Discord, etc. In this guide, we’ll show you how you can quickly deploy a TeamSpeak server in Docker on an Ubuntu Server.The ADT hero image for TeamSpeak server in Docker.

How to install Docker on Ubuntu Server

Before you can deploy your TeamSpeak server container on your Ubuntu Server, you must install Docker. To install Docker on the Ubuntu Server, start by opening up a terminal window. Then, use the apt install command to install the required packages.

sudo apt install apt-transport-https ca-certificates curl software-properties-common

After setting up the required packages, you’ll need to install the GPG key required for interacting with the Docker software repository on Ubuntu. To set up the key, run the command below.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

After adding the software key, it is time to add the official Docker software repository to the system. This software repository makes it possible to install Docker CE, which we’ll use to deploy TeamSpeak.

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

With the software repo added, run the apt update command to update your Ubuntu system software sources.

sudo apt update

Finally, you can install the latest version of Docker on your Ubuntu server system using the apt install command.

sudo apt install docker-ce

How to create your TeamSpeak Docker Compose file

The TeamSpeak server Docker information.

If you need to quickly deploy a TeamSpeak server in Docker on a Linux server, the best way to go about it is with Docker Compose. Why? With a compose file, you can define absolutely everything ahead of time, and even re-deploy multiple times with the same settings.

To start, open up a terminal on your Linux server. Once it is open, use the touch command to create a new docker-compose.yml file on the server. This file will hold all of your TeamSpeak server configuration settings.

touch docker-compose.yml

After creating the new file, open it up for editing purposes in the Nano text editor.

nano -w docker-compose.yml

Paste the code below into the newly created docker-compose.yml file. Once you’ve pasted it into the blank compose file, use the Ctrl + O keyboard combination to save the edits.

version: '3.1'
services:
  teamspeak:
    image: teamspeak
    restart: always
    ports:
      - 9987:9987/udp
      - 10011:10011
      - 30033:30033
    environment:
      TS3SERVER_DB_PLUGIN: ts3db_mariadb
      TS3SERVER_DB_SQLCREATEPATH: create_mariadb
      TS3SERVER_DB_HOST: db
      TS3SERVER_DB_USER: root
      TS3SERVER_DB_PASSWORD: example
      TS3SERVER_DB_NAME: teamspeak
      TS3SERVER_DB_WAITUNTILREADY: 30
      TS3SERVER_LICENSE: accept
  db:
    image: mariadb
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example
      MYSQL_DATABASE: teamspeak

Once you’ve pasted the code as is, it is time to edit it. To start, find “TS3SERVERDBPASSWORD: example,” and change it to something secure and memorable. Leaving it as an “example” is a very bad thing to do.

Now that you’ve changed the password, you must set the “MYSQLROOTPASSWORD: example” to a secure and memorable password. If you do not change the root MySQL password from “example,” your TeamSpeak server could be seriously vulnerable.

Once you’ve changed everything that needs to be changed, save the edits. You can save the edits to the Docker compose file by pressing Ctrl + O on the keyboard. Then, close the editor with Ctrl + X on the keyboard.

How to deploy your TeamSpeak server on Linux

The TeamSpeak server interface.

Configuring the TeamSpeak server compose file is all the heavy lifting you’ll need to do to get a TeamSpeak server up and running. Now, it is time to deploy it. Using the su command or the sudo -s command, gain root access in the terminal shell.

su

or

sudo -s

Now that you’ve got root access, use the docker compose up -d command. This command will download all images required, configure everything, and deploy the TeamSpeak server on your system. This process will take a couple of minutes to complete.

When deployment is complete, you can check on your containers by running the docker ps command. If everything is running smoothly, you’ll see your containers operating in the docker ps readout.

How to connect to your TeamSpeak server

To interact with your TeamSpeak server deployed on Ubuntu, you’ll need to have 3 things:

  • First, you’ll need the IP address of your TeamSpeak server. Hostname also works.
  • You’ll need a way to port your TeamSpeak server to the internet. For best results, consider setting up Tailscale to do this.
  • You’ll need a TeamSpeak client. They are available for Linux, Mac OS, Windows, and mobile.

When you’ve gathered these 3 things, you’ll be able to enjoy self-hosted communication in games with TeamSpeak.