This repository contains an updated Dockerfile
to easily set up and host Xonotic gaming server using Docker. Xonotic is a fast-paced first-person shooter that you can host and play online with friends.
- Make sure Docker is installed on your system.
Just pull docker image:
docker pull umair101/xonotic-server:v1.1
Alternatively, you can also build from the Dockerfile by cloning this repo.
Once you have pulled the docker file or cloned the repo you can run the Xonotic server with the following command:
docker run -d --name xonotic-server -p 26000:26000/udp -p 26000:26000 umair101/xonotic-server:v1.1
-d
Runs the container in detached mode (background).--name xonotic-server
Gives your container a name (you can change it).-p 26000:26000/udp
Exposes the default UDP port for Xonotic (port 26000).-p 26000:26000
Ensures the TCP port is also mapped if needed (may depend on your server setup).umair101/xonotic-server:latest
Specifies the image to use.
Once the server is up and running, you can connect to it from your Xonotic game client using the your IP address:
<Your_Server_IP>:26000
To stop the server, run the following command:
docker stop xonotic-server
To remove the container after stopping it:
docker rm xonotic-server
You can customize the Xonotic server by editing the configuration file server.cfg
located in the /opt/Xonotic/data/
directory. To do this:
-
Access the Container:
docker exec -it xonotic-server bash
-
Edit the Configuration: Edit the
server.cfg
file using a text editor inside the container:nvim /opt/Xonotic/data/server.cfg
-
Restart the Server to apply changes:
docker restart xonotic-server
- Persistence:
By default, the container will not store persistent data. If you want to preserve server data (e.g., configuration, maps, etc.), mount a host directory as a volume:
docker run -d --name xonotic-server -p 26000:26000/udp -v /path/to/your/server/data:/opt/Xonotic/data xonotic-server