Kart Containerized

Kart Containerized

I made sure my file(s) follow the Submissions Guidelines
  1. Yes
Kart Containerized
This is an up to date Docker image based on rwanyoikes Dockerfile.
I plan to keep this image actually up to date with the most recent version of Kart.
The image currently has tags for 1.3, 1.4, 1.5 and 1.6.

This will pull an image with SRB2Kart and start a dedicated netgame server on port 5029/udp:
Bash:
docker run -it --name srb2kart -p 5029:5029/udp ellite/srb2kart-server:latest
Addons
In order to load addons, bind the /addons volume to a host directory and copy them there.
Bash:
docker run -it --name srb2kart -p 5029:5029/udp -v /path/on/host/addons:/addons ellite/srb2kart-server:latest
Luafiles
Do your addons save configs/data in the /luafiles folder? Bind the /luafiles volume to a host directory.
Bash:
docker run -it --name srb2kart -p 5029:5029/udp -v /path/on/host/luafiles:/luafiles ellite/srb2kart-server:latest
Config
In order to configure server variables, bind the /config volume to a host directory, create kartserv.cfg, and edit it.
Bash:
docker run -it --name srb2kart -p 5029:5029/udp -v /path/on/host/config:/config ellite/srb2kart-server:latest
Bash:
sudo nano /path/on/host/config/kartserv.cfg
Persistent Data
In order to persist data through server shutdowns, bind the /data volume to a host directory.
Bash:
docker run -it --name srb2kart -p 5029:5029/udp -v /path/on/host/data:/data ellite/srb2kart-server:latest
Here's an example of how to run the container as a service on Linux with the help of systemd.
  1. Create a systemd service descriptor file:
    Bash:
    # /etc/systemd/system/docker.srb2kart.service
    [Unit]
    Description=SRB2Kart Server
    Requires=docker.service
    After=docker.service
    # Ref: https://www.freedesktop.org/software/systemd/man/systemd.unit.html#StartLimitIntervalSec=interval
    StartLimitIntervalSec=60s
    StartLimitBurst=2
    
    [Service]
    TimeoutStartSec=0
    Restart=on-failure
    RestartSec=5s
    ExecStartPre=/usr/bin/docker stop %n
    ExecStartPre=/usr/bin/docker rm %n
    ExecStartPre=/usr/bin/docker pull ellite/srb2kart-server:<version>
    ExecStart=/usr/bin/docker run --rm --name %n \
        -v <path to data directory>:/data \
        -v <path to config directory>:/config \
        -v <path to addons directory>:/addons \
        -v <path to luafiles directory>:/luafiles \
        -p <port on host>:5029/udp \
        ellite/srb2kart-server:<version>
    
    [Install]
    WantedBy=multi-user.target
  2. Enable starting the service on system boot:
    Bash:
    systemctl enable docker.srb2kart
Bash:
git clone https://github.com/ellite/srb2kart-server-docker
cd srb2kart-server-docker/
# Ref for version numbers: https://github.com/STJr/Kart-Public/releases
docker build --build-arg "SRB2KART_VERSION=<version>" \
    -t srb2kart-server:<version> .
The build will download the Source Code from a mirror (https://srb2kmods.ellite.dev/) and build the SRB2Kart executable, as well as download the data files (/usr/share/games/SRB2Kart) for SRB2Kart.

More information on how to use this on the GitHub repo.
Author
Ellite
Views
2,358
First release
Last update

Share this resource

Latest reviews

It took a little bit to figure out where everything went, but this has been working flawlessly for me. Thanks for the effort to make this work on Docker with an up-to-date version of SRB2 Kart!
Upvote 0
Back
Top