Self-Hosting a Factorio Server with Docker

What Is a Factorio Dedicated Server?

Factorio is Wube Software’s factory automation game where you build increasingly complex production chains. A dedicated server runs the game world independently, letting multiple players connect and collaborate on the same factory 24/7. The official factoriotools/factorio Docker image is the community-standard way to deploy — it handles auto-updates, mod management, and configuration through environment variables.

Updated March 2026: Verified with latest Docker images and configurations.

Official game: factorio.com | Docker image

Prerequisites

  • A Linux server (Ubuntu 22.04+ recommended)
  • Docker and Docker Compose installed (guide)
  • 2 GB of free disk space (more with mods)
  • 1 GB of RAM minimum (2 GB recommended for large factories)
  • A Factorio account (required to download the headless server)
  • Port 34197 (UDP) open on your firewall

Docker Compose Configuration

services:
  factorio:
    image: factoriotools/factorio:2.0.73
    container_name: factorio-server
    restart: unless-stopped
    ports:
      - "34197:34197/udp"
      - "27015:27015/tcp"
    environment:
      GENERATE_NEW_SAVE: "true"
      LOAD_LATEST_SAVE: "true"
      SAVE_NAME: "default-save"
      UPDATE_MODS_ON_START: "true"
    volumes:
      - factorio_data:/factorio

volumes:
  factorio_data:

Environment variables:

VariableDefaultDescription
GENERATE_NEW_SAVEfalseCreate a new map on first startup
LOAD_LATEST_SAVEtrueLoad the newest save file automatically
SAVE_NAMESpecific save file to load
UPDATE_MODS_ON_STARTfalseAuto-update installed mods on startup
PRESETMap generation preset (death-world, marathon, rich-resources)
PORT34197Game server UDP port

Note: The server runs as a non-root user (UID 845). If using bind mounts instead of named volumes, set directory ownership:

mkdir -p /opt/factorio
chown -R 845:845 /opt/factorio

Start the server:

docker compose up -d

Initial Setup

On first startup with GENERATE_NEW_SAVE: "true", the server creates a new world with default settings. To customize:

  1. Stop the server: docker compose down
  2. Edit server settings:
    docker compose run --rm factorio cat /factorio/config/server-settings.json > server-settings.json
    Edit the file — key settings include server name, description, password, max players, and auto-save interval.
  3. Copy settings back:
    docker compose cp server-settings.json factorio:/factorio/config/server-settings.json
  4. Restart: docker compose up -d

Connecting

In Factorio, go to Multiplayer → Connect to address and enter your-server-ip:34197. If you set a game password in server-settings.json, players need it to join.

Configuration

Map Generation

Customize map generation before creating a world:

# Export default map generation settings
docker compose run --rm factorio cat /factorio/config/map-gen-settings.json > map-gen-settings.json

Edit map-gen-settings.json to control resource richness, enemy bases, terrain, and map size. Copy back and recreate the save.

Use presets for common configurations:

environment:
  PRESET: death-world    # More enemies, fewer resources
  # PRESET: marathon     # Expensive recipes
  # PRESET: rich-resources  # Abundant resources

Mods

Place mod zip files in the mods directory within the data volume:

# Find the volume mount path
docker volume inspect factorio_data

# Copy mods into the volume
docker compose cp your-mod.zip factorio:/factorio/mods/

Set UPDATE_MODS_ON_START: "true" to auto-update mods when the server starts. All players must have matching mods installed.

RCON (Remote Console)

Port 27015/TCP provides RCON access for remote server administration. The RCON password is auto-generated and stored in /factorio/config/rconpw. Use any RCON client to send server commands:

# Read the RCON password
docker compose exec factorio cat /factorio/config/rconpw

Access Control

Manage player access through config files:

  • /factorio/config/server-whitelist.json — allowed players (when whitelist is enabled)
  • /factorio/config/server-banlist.json — banned players
  • /factorio/config/server-adminlist.json — players with admin privileges

Backup

Save files are the critical data. Back them up regularly:

# Backup saves
docker compose cp factorio:/factorio/saves ./factorio-saves-$(date +%Y-%m-%d)

# Backup entire config (saves + settings + mods)
docker compose cp factorio:/factorio ./factorio-full-backup-$(date +%Y-%m-%d)

The server auto-saves at configurable intervals (default: 10 minutes). Multiple auto-save slots are rotated automatically.

Backup Strategy

Troubleshooting

Server Not Visible in Multiplayer Browser

Symptom: Server doesn’t appear in the public server list. Fix: Verify visibility in server-settings.json is set to {"public": true, "lan": true}. Ensure port 34197/UDP is forwarded. Check that your Factorio username and token are set in server-settings.json.

Players Can’t Connect

Symptom: Connection timeout when joining. Fix: Confirm port 34197/UDP is open: sudo ufw allow 34197/udp. Test from outside your network. If behind NAT, set up port forwarding on your router.

Mod Version Mismatch

Symptom: Players get “mod version mismatch” errors. Fix: All players must have the exact same mod versions as the server. Export the mod list from the server and share it with players: docker compose cp factorio:/factorio/mods/mod-list.json ./.

Save File Won’t Load

Symptom: Server crashes on startup with save errors. Fix: Check if the save was created with a different Factorio version. Remove the corrupted save and let the server load the previous auto-save, or generate a new map with GENERATE_NEW_SAVE: "true".

Resource Requirements

  • RAM: 500 MB idle (new world), 1-2 GB under load (large factory with multiple players)
  • CPU: 1 core sufficient for small servers, 2+ cores for 10+ players or megabases
  • Disk: ~500 MB for game files, plus saves (1-50 MB per save)
  • Network: ~50-100 Kbps per player, low latency recommended

Verdict

Factorio is one of the easiest game servers to self-host. The Docker image handles everything — auto-updates, mod management, save rotation — and the game itself is remarkably efficient on resources. A $5/month VPS can run a small Factorio server without breaking a sweat. For multiplayer factory-building marathons, self-hosting beats paid game server providers in cost, control, and simplicity.

Frequently Asked Questions

Do I need to own Factorio to run a dedicated server?

Yes. The headless server binary requires a valid Factorio account to download. You don’t need the graphical client installed on the server — just the account credentials. Set your Factorio username and token in server-settings.json for the public server list.

How many players can a self-hosted Factorio server support?

On a single-core VPS with 1-2 GB RAM, 4-8 players is comfortable for a standard factory. Megabase builds with 10+ players need 2+ CPU cores and 4+ GB RAM. The bottleneck is CPU (game simulation is single-threaded), not network bandwidth.

Can I run Factorio alongside other Docker containers?

Yes. Factorio is lightweight — 500 MB RAM and minimal CPU when the factory is small. It coexists well with other services. Just ensure port 34197/UDP is available and you have enough RAM for both Factorio and your other containers.

How do I update the server to a new Factorio version?

Update the image tag in docker-compose.yml (e.g., factoriotools/factorio:2.0.74), then run docker compose pull && docker compose up -d. Your save files persist in the volume. Back up saves before major version upgrades — saves from newer versions aren’t backwards-compatible.

Can I use server-side mods?

Yes. Place mod ZIP files in the mods directory inside the data volume and set UPDATE_MODS_ON_START: "true". All connecting players must have the exact same mod versions installed. Share the mod-list.json from the server with your players.

Is it cheaper to self-host than rent a Factorio server?

For a small server (2-4 players), a $4-5/month VPS handles it easily. Rental game server providers typically charge $5-15/month for Factorio. Self-hosting is comparable in cost but gives you full control over mods, configuration, and uptime.

Comments