Use Coupon WELCOME to save 20%

$ USD
  • $ USD
  • € EUR
  • £ GBP
  • $ AUD
  • R$ BRL
  • CHF CHF
  • ¥ JPY
How to Run a FiveM Server Using Docker

Run FiveM in Docker with Persistent Data and Private txAdmin

A Docker deployment needs persistent server data, deliberate port exposure and a recoverable image/configuration pair. The example below uses the community-maintained spritsail image on a Linux host; its paths and environment variables are specific to that image, not universal FXServer options.

The configuration and code examples here target FiveM for GTA V Legacy. Enhanced has different runtime and compatibility rules; check Cfx.re’s Legacy-to-Enhanced changes before applying them to an Enhanced server.

Prepare the host

Install Docker Engine and the Compose plugin using Docker’s instructions for your host. Use an isolated test deployment first. Confirm that the host architecture, available ports and image release fit your intended server.

Create a private project directory with data/ and txData/ subdirectories. The image uses /config for server data and /txData for txAdmin. Restrict access to the host directories and backups because they will contain credentials.

Create compose.yaml

Save this as compose.yaml in that project directory. It leaves license configuration to the protected txAdmin/server setup and binds the administration port to host loopback.

services:
  fivem:
    image: spritsail/fivem:stable
    environment:
      NO_DEFAULT_CONFIG: "1"
      NO_LICENSE_KEY: "1"
    volumes:
      - ./data:/config
      - ./txData:/txData
    ports:
      - "30120:30120/tcp"
      - "30120:30120/udp"
      - "127.0.0.1:40120:40120/tcp"
    stdin_open: true
    tty: true
    restart: unless-stopped
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"

The image’s stable tag is mutable and follows the upstream image maintainer’s definition. Read its release/source before deploying; do not treat the word “stable” as a tested guarantee. After testing, replace the image reference with the exact pulled digest you record.

Start and configure txAdmin

From the project directory on the Docker host, run:

docker compose config --quiet
docker compose pull
docker compose up -d
docker compose logs --tail=100 fivem

Access txAdmin locally at http://127.0.0.1:40120. From your workstation, create an SSH tunnel to your actual host using ssh -L 40120:127.0.0.1:40120 user@your-server, then open that same local address in your browser. Use your real SSH account/hostname. Do not publish setup PINs or log output containing credentials.

Follow txAdmin’s setup and choose a server-data location inside /config, or another explicitly mounted persistent directory. Enter the valid server license privately. If the selected recipe needs a database, provision that separately and keep its port private; this Compose example does not include one.

Verify networking and persistence

Allow the intended player endpoint through the host/provider network for TCP and UDP. Check access from outside the host. Docker-published ports interact with Docker’s firewall rules and can bypass ordinary UFW input rules; consult Docker’s firewall documentation instead of pasting a replacement firewall ruleset.

Complete a test join, inspect resource errors and create a harmless configuration change. Recreate the container with docker compose up -d --force-recreate and confirm the profile/configuration persists. An HTTP response from info.json is only a basic availability check, not proof of gameplay health.

Back up a consistent set

Schedule maintenance and stop gameplay writes. Back up the mounted directories, Compose definition, private configuration and any external database as one matching recovery set. For file-only data while the service is stopped, a private archive from the project directory can be created with:

umask 077
docker compose stop fivem
tar -czf "../fivem-files-$(date -u +%Y%m%dT%H%M%SZ).tgz" compose.yaml data txData
docker compose start fivem

Check archive creation succeeded before restarting as part of your runbook. Include additional configuration files and the database backup when your setup uses them. A files archive alone cannot restore an external database. Test recovery into separate directories and a separate database.

Update and recover

Record the currently running image digest and take the matching backup before pulling an update. Test the candidate image against a copy, then change the production image reference during maintenance and repeat join/persistence checks.

Rolling back only the image may not undo data migrations performed by resources. Recover the matching files/data deliberately and account for writes since the backup. docker compose down stops/removes the service while retaining these bind-mounted directories; keep those directories until recovery is no longer needed.

Reference documentation

Source: spritsail/fivem · Source: docs.docker.com · Cfx.re — txAdmin