A realistic planning buffer on top of your normal FiveM server footprint.
4-8 GB RAM
32-slot baseline
Typical allocation range for moderate script stacks with txAdmin and persistent volumes.
40120/TCP
Recommended txAdmin port
Keep it exposed separately so first-run setup and recovery stay straightforward.
Running a FiveM server inside Docker gives you environment consistency, simplified backups, reproducible deployments, and the ability to run multiple isolated server instances onβ¦
Share
How to Run a FiveM Server Using Docker: Complete Setup Guide
Running a FiveM server inside Docker gives you environment consistency, simplified backups, reproducible deployments, and the ability to run multiple isolated server instances on a single host. If you have ever spent hours debugging a server that works on one machine but not another, Docker eliminates that problem entirely.
This guide walks you through the complete process: from creating your Dockerfile to running a production-ready FiveM server with docker-compose, persistent storage, txAdmin, and proper resource management.
Prerequisites
Before starting, make sure you have:
A Linux VPS or dedicated server (Ubuntu 22.04+ or Debian 12+ recommended)
Docker Engine 24+ and Docker Compose v2 installed
A Cfx.re account with a valid server license key
Basic familiarity with the Linux command line
If Docker is not installed yet, the official installation takes less than a minute:
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
Log out and back in for the group change to take effect. Verify with docker --version and docker compose version.
Project Structure
Organize your FiveM Docker setup with a clean directory structure. This separation keeps your configuration, resources, and data manageable:
fivem-server/
βββ docker-compose.yml # Container orchestration
βββ Dockerfile # Server image definition
βββ server-data/
β βββ server.cfg # FiveM server configuration
β βββ resources/ # Your scripts and assets
β βββ [system]/
β βββ [gameplay]/
β βββ [maps]/
βββ txData/ # txAdmin persistent data
βββ backups/ # Automated backup target
Frequently Asked Questions
Can I run txAdmin inside the Docker container?
Yes. txAdmin is bundled with the FiveM server artifacts. Expose port 40120 in your docker-compose.yml and access the txAdmin web panel at http://your-server-ip:40120. The initial setup wizard runs on first launch. Mount your txAdmin data directory as a volume to persist configuration across container restarts.
How much RAM does a Dockerized FiveM server need?
Plan for the same resources as a bare-metal install plus roughly 100-200 MB overhead for the container runtime. A 32-slot server with moderate scripts needs 4-8 GB RAM allocated to Docker. Set memory limits in docker-compose.yml with deploy.resources.limits.memory to prevent the container from consuming all host RAM.
Can I run multiple FiveM servers on one host using Docker?
Absolutely β this is one of Docker's biggest advantages for FiveM hosting. Each server runs in its own container with isolated ports, resources, and configurations. Use different host port mappings (e.g., 30120, 30121, 30122) and separate volume mounts for each server instance. Docker Compose makes managing multiple servers straightforward.
Will Docker add noticeable latency for players?
No. Docker uses the host's network stack directly (especially with network_mode: host) and adds negligible overhead. The containerization layer operates at the OS level, not through virtualization. Players will not notice any difference compared to a bare-metal installation. CPU-bound operations like script execution perform identically.
Turn framework research into a launch-ready script stack
Use this guide to narrow the framework decision, then move into the core commercial hubs for verified scripts, curated bundles, and a faster server launch path.
Complete server path
If the article is part of a launch plan, start with full server packs that reduce setup time and connect multiple systems faster.
Open full server packs
Launch faster
Bundles shorten the path from planning to launch by grouping the highest-leverage scripts into a cleaner commercial starting point.
View bundles
Premium catalog
Move from research into the main shop to compare real products, framework labels, screenshots, and production-ready quality signals.
Open premium shop
Free Scripts You Might Like
Related Articles
Running a FiveM server is not a simple task. You're managing game logic, player connections, database integrity, voice systems, and community dynamics all at once.
To set up a FiveM GTA RP server in 2026, install txAdmin on a Windows or Linux machine with at least 8 GB of RAM, let it download the FXServer artifacts automatically, create anβ¦
Running a FiveM server allows you to create a customized multiplayer experience for Grand Theft Auto V. However, like any server software, you may...
Create the base structure:
mkdir -p fivem-server/{server-data/resources,txData,backups}
cd fivem-server
The Dockerfile
The Dockerfile builds a minimal image that downloads the latest FiveM server artifacts and sets up the runtime environment:
FROM debian:12-slim
ARG FIVEM_VERSION=latest
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
xz-utils \
libatomic1 \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /opt/fivem /txData
# Download and extract FiveM server artifacts
RUN DOWNLOAD_URL=$(curl -s "https://changelogs-live.fivem.net/api/changelog/versions/linux/server" \
| grep -oP '"latest":"[^"]*"' | head -1 | grep -oP 'https[^"]*') \
&& curl -Lo /tmp/fx-server.tar.xz "$DOWNLOAD_URL" \
&& tar -xf /tmp/fx-server.tar.xz -C /opt/fivem --strip-components=1 \
&& rm /tmp/fx-server.tar.xz
WORKDIR /opt/fivem
# FiveM game port (UDP + TCP)
EXPOSE 30120/tcp
EXPOSE 30120/udp
# txAdmin web interface
EXPOSE 40120/tcp
ENTRYPOINT ["/opt/fivem/run.sh"]
CMD ["+exec", "/server-data/server.cfg"]
Build the image:
docker build -t fivem-server:latest .
The image weighs approximately 200-300 MB β significantly smaller than a full Ubuntu install with the same dependencies.
Docker Compose Configuration
Docker Compose defines how your container runs, including port mappings, volume mounts, resource limits, and restart behavior. This is where the operational advantages of Docker become tangible.
restart: unless-stopped ensures the server comes back after crashes or host reboots without restarting containers you intentionally stopped.
Volume mounts keep your server data and txAdmin configuration outside the container. Rebuilding or updating the image never touches your data.
Memory limits prevent a resource leak or poorly written script from consuming all host RAM and crashing other services.
Log rotation prevents Docker logs from filling your disk over time β a common issue on long-running game servers.
Server Configuration
Create your server-data/server.cfg with the essential directives:
# Server Identity
sv_hostname "My Docker FiveM Server"
sv_projectName "My Server"
sv_projectDesc "A containerized FiveM server"
sets sv_projectName "My Server"
# License and Authentication
sv_licenseKey "your-license-key-here"
sv_maxclients 32
# Network
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
# Security
sv_scriptHookAllowed 0
set steam_webApiKey ""
# txAdmin
set txAdminPort 40120
# Resources
ensure mapmanager
ensure spawnmanager
ensure sessionmanager
ensure basic-gamemode
ensure hardcap
ensure chat
ensure monitor
Replace your-license-key-here with your actual Cfx.re license key. You can generate one at keymaster.fivem.net.
Starting the Server
Launch the server with a single command:
docker compose up -d
Monitor the startup process:
docker compose logs -f fivem
You should see the FiveM server initializing, loading resources, and eventually displaying the server startup message. txAdmin will be accessible at http://your-server-ip:40120 once the container is running.
To stop the server gracefully:
docker compose down
To restart after configuration changes:
docker compose restart fivem
txAdmin Setup Inside Docker
When you access http://your-server-ip:40120 for the first time, txAdmin walks you through the initial setup wizard:
Create your txAdmin admin account (separate from your Cfx.re account)
Link your Cfx.re account for license validation
Select the server data path β point it to /server-data
Choose your server template or point to your existing server.cfg
The txAdmin data directory (/txData) is mounted as a volume, so your admin accounts, player bans, scheduled restarts, and backups persist across container rebuilds.
Adding Resources and Scripts
Install scripts into your server-data/resources/ directory on the host machine. Changes are immediately visible inside the container because of the volume mount β no rebuild required.
# Example: Install a resource from GitHub
cd server-data/resources/
git clone https://github.com/example/my-resource.git
# Then add to server.cfg
echo 'ensure my-resource' >> ../server.cfg
Docker volumes ensure your data survives container restarts, updates, and rebuilds. The two critical directories are:
./server-data: Your server configuration, resources, and any file-based data
./txData: txAdmin configuration, player database, ban lists, and admin accounts
Automate backups with a simple cron job:
# Add to crontab (crontab -e)
0 4 * * * cd /path/to/fivem-server && tar -czf backups/backup-$(date +\%Y\%m\%d).tar.gz server-data/ txData/ --exclude='server-data/cache'
This creates a daily compressed backup at 4 AM, excluding the cache directory which can be regenerated. Rotate old backups to prevent disk fill:
# Keep last 14 days of backups
find /path/to/fivem-server/backups -name "backup-*.tar.gz" -mtime +14 -delete
Updating the FiveM Server
Updating a Dockerized FiveM server is clean and predictable. Your server data stays untouched β only the server artifacts change:
# Rebuild the image with latest artifacts
docker compose build --no-cache fivem
# Restart with the new image
docker compose up -d fivem
If something breaks after an update, rolling back is instant:
# Tag your current working image before updating
docker tag fivem-server:latest fivem-server:backup
# If the update causes issues, revert
docker tag fivem-server:backup fivem-server:latest
docker compose up -d fivem
This rollback capability alone makes Docker worth the setup effort. On a bare-metal server, reverting a bad update means manually restoring files and hoping you didn't miss anything.
Running Multiple Servers
One of Docker's strongest advantages for FiveM hosting is running multiple isolated server instances on a single host. Each server gets its own container, ports, and data:
In your resource database configuration (e.g., oxmysql or mysql-async), use db as the hostname since Docker Compose creates an internal network where containers can reach each other by service name:
set mysql_connection_string "mysql://fivem:change-this-too@db:3306/fivem?charset=utf8mb4"
Production Hardening
Before exposing your Dockerized FiveM server to players, apply these production best practices:
Firewall Rules
Only expose the ports you actually need:
# Allow FiveM game traffic
sudo ufw allow 30120/tcp
sudo ufw allow 30120/udp
# Allow txAdmin (restrict to your IP if possible)
sudo ufw allow from YOUR_IP to any port 40120
# Block everything else
sudo ufw enable
Health Checks
Add a health check to your docker-compose.yml so Docker can detect and restart a stuck server:
Set up alerts when memory or CPU usage exceeds thresholds to catch problems before players notice them.
Troubleshooting Common Issues
Container exits immediately after starting:
Check the logs with docker compose logs fivem. Common causes: invalid license key, missing server.cfg, or port conflicts. Verify your license key is correct and no other process is using port 30120.
Cannot connect to the server:
Ensure ports 30120/tcp and 30120/udp are open in your firewall and correctly mapped in docker-compose.yml. Test with docker compose port fivem 30120 to verify the mapping.
txAdmin not accessible:
Verify port 40120 is exposed and not blocked by a firewall. Check that the TXADMIN_PORT environment variable matches the exposed port.
Resources not loading after adding them:
Volume mounts sync automatically, but FiveM needs a restart to detect new resources. Run docker compose restart fivem and ensure the resource is listed in server.cfg with ensure.
Database connection refused:
If using Docker Compose networking, use the service name (e.g., db) as the hostname, not localhost or 127.0.0.1. The database container must be running and healthy before FiveM starts β depends_on handles startup order.
Docker transforms FiveM server management from manual sysadmin work into reproducible, version-controlled infrastructure. Every configuration change is tracked, every update is reversible, and every backup is predictable. That operational discipline is what separates servers that last from servers that burn out.