docker-gameserver for LinuxGSM

repository·main·Indexed 43 days ago

https://github.com/gameservermanagers/docker-gameserver

A collection of Docker images for deploying, managing, and persisting Linux Game Server Managers (LinuxGSM) game servers. Supports deployment via Docker CLI and Docker Compose, utilizing the /data directory for persistent storage and gosu for permission management.

Tokens
963
Snippets
4
Records
6
Agent score
6%

What's inside docker-gameserver

  1. Configure persistent storage and permissions

    main

    The container uses the /data directory as the home directory for the linuxgsm user. This directory stores all game server files, including those that might be stored outside the serverfiles directory.

    Storage Types:

    • Both Docker volumes and bind mounts are supported.
    • Permissions: If using a bind mount, ensure the host directory permissions allow the linuxgsm user to read and write to it, as the container uses gosu to run processes as linuxgsm rather than root.
  2. Deploy a game server using docker-compose

    main

    To deploy a game server, create a docker-compose.yml file. You must update the image tag and container_name to match your specific game server (e.g., cs2).

    Important Notes:

    • Ports: The example uses generic ports. You must configure the specific ports required by your game server after the initial run. The required ports will be printed to the logs during installation.
    • Networking: Using network_mode: host is an option to simplify port management, but you can also use standard port mapping.
    • Persistence: You must mount a host directory to /data to ensure game files and configurations are preserved.
    services:
      linuxgsm-cs2:
        image: ghcr.io/gameservermanagers/gameserver:cs2
        # image: gameservermanagers/gameserver:cs2
        container_name: cs2server
        volumes:
          - /path/to/cs2server:/data
        network_mode: host
        restart: unless-stopped
  3. Deploy a game server using Docker CLI

    main

    You can run the game server container directly using the Docker CLI. Ensure you map the necessary game ports and mount a persistent volume to /data.

    docker run -d \
      --name cs2server \
      -v /path/to/cs2server:/data \
      -p 27015:27015 \
      -p 27020:27020/udp \
      -p 27005:27005/udp \
      --restart unless-stopped \
      gameservermanagers/gameserver:cs2
  4. Configure the LinuxGSM service with docker-compose

    main

    You can deploy a Counter-Strike 2 (CS2) game server using docker-compose. The service is named linuxgsm and uses a specific Dockerfile for the CS2 build context. By default, it maps the necessary TCP and UDP ports for game traffic and RCON/Steam communication. The container is configured to restart automatically unless it is manually stopped.

    services:
      linuxgsm:
        build:
          context: .
          dockerfile: dockerfiles/Dockerfile-cs2
        container_name: cs2server
        ports:
          - "27015:27015/tcp"
          - "27015:27015/udp"
          - "27020:27020/udp"
          - "27005:27005/udp"
        restart: unless-stopped