spritsail/fivem Docker Image

repository·master·Indexed 41 days ago

https://github.com/spritsail/fivem

A Dockerized environment for running FiveM servers. It simplifies deployment and configuration of modded GTA multiplayer servers using environment variables like LICENSE_KEY and NO_DEFAULT_CONFIG, and supports persistent volume mounts for /config and /txData. Includes support for the txAdmin Web UI and provides both latest and stable image tags.

Tokens
1.3K
Snippets
6
Records
8
Agent score
2%

What's inside spritsail/fivem

  1. Run a FiveM server with Docker

    master

    To run a basic FiveM server, use the spritsail/fivem image. You must provide a valid FiveM license key via the LICENSE_KEY environment variable.

    Important: You must use the -ti (interactive and pseudo-tty) flags, otherwise the container will crash on startup.

    Upon the first run, the container generates configuration files in the host directory mounted to /config. You should stop the container after the first run to modify the server.cfg to your requirements before starting it again.

    docker run -d \
      --name FiveM \
      --restart=on-failure \
      -e LICENSE_KEY=<your-license-here> \
      -p 30120:30120 \
      -p 30120:30120/udp \
      -v /volumes/fivem:/config \
      -ti \
      spritsail/fivem
  2. Enable and configure the txAdmin Web UI

    master

    To use the txAdmin web interface, you must prevent the FXServer binary from using the default execution configuration. This is done by setting the NO_DEFAULT_CONFIG environment variable to any non-zero value.

    txAdmin stores its configuration and database in /txData. To ensure this data persists across container restarts, you must mount a volume to /txData. You also need to expose the txAdmin webserver port (default 40120).

    docker run -d \
      --name FiveM \
      --restart=on-failure \
      -e LICENSE_KEY=<your-license-here> \
      -p 30120:30120 \
      -p 30120:30120/udp \
      -p 40120:40120 \
      -v /volumes/fivem:/config \
      -v /volumes/txData:/txData \
      -ti \
      spritsail/fivem
  3. Configure the spritsail/fivem Docker Compose setup

    master

    Use the following docker-compose.yml structure to deploy the FiveM server. You must provide a valid LICENSE_KEY in the environment section and configure volume mounts for your server resources and txAdmin data to ensure persistence.

    version: '3'
    
    services:
      fivem:
        image: spritsail/fivem
        container_name: fivem
        restart: always
        stdin_open: true
        tty: true
        volumes:
          - "/path/to/resources/folder:/config"
          # - "/path/to/txData/folder:/txData"
        ports:
          - "30120:30120"
          - "30120:30120/udp"
          # - "40120:40120"
        environment:
          LICENSE_KEY: "license-key-here"
  4. Choose a FiveM image tag

    master

    The spritsail/fivem image provides two main tags:

    • latest: The default tag, based on the most recent FiveM build.
    • stable: Based on the "optional" FiveM release.

    Note: An image based on the "recommended" FiveM release is not provided as it is typically too stale.

  5. Reference: Environment Variables

    master

    The following environment variables are used to configure the FiveM container:

    VariableDescription
    LICENSE_KEYRequired. The license key needed to start the server.
    RCON_PASSWORDPassword for fxserver RCON functionality. If not specified, a random 16-character password is assigned during default config creation.
    NO_DEFAULT_CONFIGOptional. Set to any non-zero value to disable the default exec config. Required for txAdmin usage.
    NO_LICENSE_KEYOptional. Set to any non-zero length value to disable specifying the license key via environment variables (useful if the key is in a config file).
    NO_ONESYNCOptional. Set to any non-zero value to disable OneSync being added to the default configs.
  6. Configure FiveM volume mounts

    master

    Use volumes to persist server data and configuration outside the container lifecycle:

    • /config: Mount your server resources and configuration files here (e.g., - "/path/to/resources/folder:/config").
    • /txData: Mount txAdmin's data files here to persist txAdmin settings and data (e.g., - "/path/to/txData/folder:/txData").
    volumes:
      - "/path/to/resources/folder:/config"
      - "/path/to/txData/folder:/txData"
  7. Configure FiveM port mappings

    master

    Expose the following ports to allow client connections and web management:

    • 30120 (TCP): The default FiveM server port.
    • 30120 (UDP): The default FiveM server port for UDP traffic.
    • 40120 (TCP): The default port for the txAdmin web interface.
    ports:
      - "30120:30120"
      - "30120:30120/udp"
      - "40120:40120"